This project is read-only.

Parallel Fox - Persistent Thread Suggestion

Topics: Enhancement Request
Feb 9, 2011 at 10:01 PM

I started using Parallel Fox recently for a different kind of threading need. My core application is a TCP server and it must respond to requests quickly, ideally in less than 1 second. This core app is also responsible for retrieving emails via a stateful connection.  Managing the constant-on connection, with possible disconnects, reconnects, fetching mail etc. would block the core process, so I wanted a threaded program to run, but not terminate, until the core program does. With a little exploration, I was able to use the current Parallel Fox to do it, but it's a different scenario than you have shown in your demos and I think it's a very useful one. The one addition to the current project (other than another video example) that I would like to see is a call back method similar to UpdateProgress() that could be event bound to a method on the parent app, possibly named 'Notify()'?

Let me know if you think it would be a useful addition to the project and I'd be happy to share the code.

Thanks for a great addition to VFP!


Feb 9, 2011 at 11:17 PM

Hi Matt,

Since you know about UpdateProgress(), I will assume you already watched the training videos on Worker Events.  If not, I recommend you start there.  Those videos demonstrate a couple of ways to create your own custom events:

1) You can use ReturnData to return whatever information you want to the main process.  If multiple "events" occur in your worker, then the first parameter you return could be the name of the event (e.g. "Notify"), and the event handler in your main process could route the call accordingly.

2) You can create your own callback object (perhaps with a Notify() method) and pass it as a parameter to the worker.  Then just call oMyObject.Notify() from the worker when you need to.  If you want the callback object to persist beyond the current call to the worker, simply make it public or add it as a property to _Screen.

If those options don't meet your needs, or if I'm just not explaining it very well, please give me a little more detail and we'll work it out.



Aug 2, 2011 at 8:04 AM

hi joelleach,

when using parllelfox in without debugging mode. i will giving error.  "Class Definition PARALLELFOX.WORKERMGR" is not found"



Aug 2, 2011 at 5:22 PM

DO INSTALL to register ParallelFox.exe on your development machine.  When deploying to other machines, you need to register by running ParallelFox.exe /regserver.  See the INSTALL.PRG code for an example of this.

Aug 2, 2011 at 6:23 PM

@mattw, there could be an alternative:

btw, could you tip me on how to download emails? sample, link, anything other than build it myself upon the RFC ?!