PDA

View Full Version : Use the spawn command to run multiple background threads



hmischel@diligentsystems.com
2016-09-18, 00:16
I have an older VFP App where I use the run command to run some background processes. I have replaced them with the Lianja spawn command

The Spawn command uses the same syntax as the run command.

Spawn will run your process in the background and return control of your app back to while it is running.

Thats very handy if you need to run simultaneous operations while not relinquishing control of your application.

Herb

HankFay
2016-09-18, 14:39
To add to what Herb indicated:

1) if you are running a lot of processes, you can end up overloading the processor and hurting UI performance. This would especially be the case if you were running a Lianja Desktop App on a remote desktop-type (RDP or ICA) environment.

2) you can monitor what processes you have running by getting the pid of a spawned process using ActivePid().

3) If you do have a cajillion background processes to run, you can run the spawn off a web service call to another server where the Lianja Cloud Server is running. Maintaining a central database with server and pid will allow you to coordinate all this.

4) You can get return values in a variety of ways. SharedMemory is one way (google Lianja Shared Memory). Another way is to the use monitoring database table entry for a given server and pid to hold the return value.

hth,

Hank