in reply to Re^2: point #4 (Now what was that you were saying?)
in thread Thoughts on how to devise a queryable win32 service
Note that a shared variable guarantees that if two or more threads try to modify it at the same time, the internal state of the variable will not become corrupted. However, there are no guarantees beyond this, as explained in the next section.
And the next section describes some typical race condititons one might encounter (two threads trying to read, then increment the same variable).
So anyway, that text has led me to believe that a shared array used to implement a queue for passing data between threads would be safe, even with no locking, since the push() and shift() operations would be atomic in nature.
If this doesn't apply to SMP machines though, then I've got some code to fix...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: point #4 (Now what was that you were saying?)
by BrowserUk (Patriarch) on Feb 10, 2005 at 17:47 UTC |