Find the answer to your Linux question:
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 ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    1

    Unhappy 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

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Do this at the command line:
    Code:
    less /usr/include/asm/atomic.h
    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...