FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour OT: Sharing variables among different tasks
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
OT: Sharing variables among different tasks
Posted: Mon Aug 30, 2010 04:21 PM

Dear friend,
I'm searching documentation about sharing of one or more variables between tasks.
Any advice?
Thanks in advance
Marco
For example In the first task (task1.exe) I have this

cVariab := "Marco Boschi"

and obviously when this task is running.....

In the second task would be fantastic a command like this

? GetOtherTaskVar( "task1.exe", cvariab ) //

? "Marco Boschi"

P.S. I'm serious :-)

Marco Boschi
info@marcoboschi.it
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: OT: Sharing variables among different tasks
Posted: Mon Aug 30, 2010 05:18 PM

The easiest way is to have a database that can be called from different .exe's and where you store those variables. You could also use a text file ( like an .ini ). Be sure to refresh your mem variables in the program from that file periodically.

Yes ... I do this, especially with my auto update routines. The CONFIG.dbf file holds variable data that may be used by 4 different programs. It resides on the server and is read at the clients. A timer provides for periodic updating when values change, and before certain operations, that data is re-read from the server, so I don't have to ever leave the client program to get the latest values.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: OT: Sharing variables among different tasks
Posted: Fri Sep 03, 2010 07:05 AM

Tim,
thank you for your interest.
The problem is: I wouldn't like to load and unload from the disk into memory variables.
It takes too long for what I do.

My goal is as follows: to load into memory an entire dbf table and perform fast wild searches.
I imagine this scenario in a server

First task
- initial load of the table into one single variable.
- for any change in the table must follow an update of the variable in memory

Second task
- waits for user's requests of searches from clients reading new records in a shared table
- perform the requested search into shared variable (in memory) and not into the dbf table

best regards
marco

Marco Boschi
info@marcoboschi.it
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: OT: Sharing variables among different tasks
Posted: Fri Sep 03, 2010 11:39 AM

Hello,

at less you work with "Interprocess Communication" I don't see other way

regards

Marcelo

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: OT: Sharing variables among different tasks
Posted: Fri Sep 03, 2010 01:16 PM

Many thanks Marcelo

marco

Marco Boschi
info@marcoboschi.it

Continue the discussion