Results 1 to 2 of 2
Hi,
On a single CPU machine ++*sem and --*sem (sem being a pointer to an int or long depending on the OS) are "atomic" but on a multi-cpu machine they ...
- 10-31-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 1
Atomic Task and Set Operations
Hi,
On a single CPU machine ++*sem and --*sem (sem being a pointer to an int or long depending on the OS) are "atomic" but on a multi-cpu machine they appear not to be.
On Apple, SCO, Windows, and AIX all have an atomic function to do this.
In Windows the function is : InterlockedExchange(sem,1) which if *sem is zero it puts a 1 in and returns 0 ...
In SC the function is qxchgl( sem, 1 ) and works the same as windows.
I am looking for a linux implementaion of the above. Please can any one help?
Regards,
Chris
- 10-31-2007 #2
Do this at the command line:
Hope this helps.Code:less /usr/include/asm/atomic.h


Reply With Quote