Using version 1.1, the
Environment->Settings->Run DDE Server
works as expected.
Hmm doesnt work for me on RC1-1
Ah well... will have to live with it then.
Thomas: as an atomic operation I mean [...] scheduler cannot interrupt the running process [...]
i.e. say one process issues a createtempfile operation followed by a event notification "I have created my tempfile" to 2nd process. Now these two instructions are not atomic. You can have p1: create tempfile, context switch p2: create tempfile, before any event notifications occur.
Yes, I understand "atomic"
This is not really a problem, though. The case you describe is pretty much the same as case 3 in my above post. If you are really pedantic about what you execute and what you delete, and when, there are not so many bad things that can happen.
- When creating a tempfile, you can open it write-exclusive, this does not cost you anything. If the app crashes, you have one stale file lingering, but so what... after next reboot, it will be unlocked and can be deleted. As long as you have not closed your file, no one can delete it. So if another instance gets a notification from anywhere, and tries to delete that file, it will know that its contents is not valid.
- When getting a notification, you just look at everything you can get from that one directory.
If it is old, forget it and delete it. That way, no stale files persist forever.
Go on, read it in and try to delete the file. If the delete fails, forget it - it is still in use and you'll probably get another notification soon.
Otherwise, handle the contents that you have read in.
This is truly not atomic, but it is "atomic enough", that is, atomic where it absolutely must. When opening two files simultaneously, it does not matter in which order they are opened or how many milliseconds lie between opening them. Atomicity is only important here insofar as no requests should be completely lost, and no garbled data should be used. This is guaranteed by write-exclusive and delete. The good thing is it uses no OS-dependent features. The worst thing to happen is scanning a directory and opening one or two files in vain.
But well, given that the DDE server seems to work, this is purely academic now. Never change a working system.
EDIT: Little mistake of mine. You might rather append a char to the file before reading its contents. This is better because the read-delete strategy is in fact flawed. Appending a char to the file ensures that it has been closed by the other process (thus, its data is valid), and you can still read it in (minus one char) afterwards. This really makes it atomic. The delete can be any time later then.