Archived Boards > WinBatch Script Exchange

Global Atom UDFs - sharing data between applications in memory

<< < (2/3) > >>

td:
Use the atom API with care.  Atoms are used by several OS subsystems and the OS will get very unhappy, if you don't play nice.

DAG_P6:

--- Quote from: td on December 03, 2015, 08:01:47 am ---Use the atom API with care.  Atoms are used by several OS subsystems and the OS will get very unhappy, if you don't play nice.

--- End quote ---

In particular, as I recall, DDE makes extensive use of global atoms.

However, if you take care to verify that an atom that you want to use doesn't exist before you create it, and manage your own reference counts, so that your add and delete counts are always equal, they should be safe to use. I discovered global atoms in 1997, when I needed a way to pass information between 16 and 32 bit processes, for which it worked extremely well. For example, I would put a string in the global atom table, then pass its numeric ID to the 16 bit process, which would retrieve and delete the atom. This technique provided me with a very effective way for the 16 bit process to signal that it was done, by deleting the atom passed to it by the 32 bit process.

I'm happy to see that another old-timer has posted his atom UDFs, because I have thought several times that I should post mine.

td:
Atoms are used by more significant systems than just DDE.   They are a shared resource used by the OS kernel in ways that are not even visible to user mode programmers.   

DAG_P6:

--- Quote from: td on December 07, 2015, 06:36:11 am ---Atoms are used by more significant systems than just DDE.   They are a shared resource used by the OS kernel in ways that are not even visible to user mode programmers.

--- End quote ---

I was aware of that, too. I mentioned DDE solely as an example that should be relatively familiar to most.

Moreover, the critical take-away is that, since I did my own reference counting, my use of the global atom table shouldn't interfere with whatever Windows has stashed there.

td:
While both WinBatch and a few extenders use atoms, system device drivers and other processes also  make use of atoms.  Also note that I said use with care not don't use at all. In other words, seemingly correctly coded implementations can lead to out sized problems if an apparently 'trivial' bug exists in the implementation. 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version