this is Long, I am sorry,
TL;DR
how can you make code thread safe when it maybe necessary under some
conditions (which would themselves be not thread safe) to reach into a
separate process to get or set values.
(I need a means to manage IP sets which is thread safe, OR I need a way
to Set and Get values across processes which is thread safe.)
First, I know that in some of the versions referenced in the title
pre-emptive threading is not available. I would like to 'future proof'
the component as much as possible, I am starting in v13.
I intentionally left out v17, as I believe in v17+ I can use Storage to
do what I am asking about.
I have a component Setutl, which does a bunch of set related
manipulations, and management.
I have come across an issue I do not see a resolution for, and am
looking for some ideas.
As the component deals with sets, it is reasonable to expect to have to
manage IP sets. In my current version of Setutl (not yet released for
those using it), I do this by spawning a process during Setutl's init
which is used only for managing IP sets. To do the various management
functions, I currently use SET PROCESS VARIABLE and GET PROCESS
VARIABLE (I know both are not thread safe). I have been thinking about
how to replace those commands.
I was going to use the pasteboard to pass information to and from the
IP set tracking process, but as I discovered yesterday - this could be
a problem...
- If the component is accessed from any of the Drag n Drop form events,
there is a pasteboard 4D uses that is separate from the 'normal'
pasteboard available everywhere else. This could/would result in issues
where the passed data is put on the Drag n Drop pasteboard which would
not be available to the process in which the IP set management occurs,
and vise verse.
Yes, I know if there is an IP set in use, the host process can not be
thread safe, BUT, (see below) the code works roughly as follows:
If (setult_Does_Set_Exist($Setname))
if (setutl_What_Table($Setname)=->[My_Table])
do stuff
Where Setutl does not care if the set passed ($Setname) is local,
process, or IP. In Setutl's code a check is done on the set name,
looking for the left right arrow pairing (<>), and branches as needed
to manage either 'normal' sets, or IP sets. This, if I understand
correctly, means that the code to manage the IP sets needs to be thread
safe for the Setutl functions (above) to be thread safe; and this
extends to most of Setutl's functionality.
So, for the Setutl component to be thread safe all of the code in the
component would need to be thread safe, so I need a means to manage IP
sets which is thread safe, OR I need a way to Set and Get values across
processes which is thread safe.
Thanks for getting this far
Chip
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************