Author: Dann Corbit
Date: 18:52:57 12/27/01
Go up one level in this thread
On December 27, 2001 at 21:26:01, Russell Reagan wrote: >I've taken a look at the Interlocked functions and they look like the best >solution since I'll be mainly dealing with some simple data shared between >threads. I'd like to make sure I'm understanding a few of them. With pointers >aside... > >InterlockedExchange(A,B) is equivalent to A = B > >InterlockedCompareExchange(A,B,C) is equivalent to if(A == C) A = B; > >InterlockedDecrement(A) is equivalent to A--; > >InterlockedIncrement(A) is equivalent to A++; > >InterlockedExchangeAdd(A,B) is equivalent to A = A + B; > >Are these statments *basically* correct? Of course I have left out the facts >that some parameters are pointers and such, but I'm working on getting the >"general idea" here :) > >If I am correct in my understanding of how these functions work, then I thank >you all very much for your help. That's the basic notion. I would encourage you to go over your data structures and carefully see which ones can be made automatic and which ones need to be public. I think Dr. Hyatt has figured out some way to access the hash table from multiple threads without any locking at all (though for the life of me, I can't see how this is possible). So you might want to go over his hash table stuff. Also, think about portability. If possible, isolate your system specific stuff so that when you port to another platform, it won't be horribly painful.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.