atomic operations under linux

atomic operations under linux

guy keren choo at actcom.co.il
Thu Dec 10 00:05:10 IST 2009


Micha wrote:
> On 09/12/2009 18:49, guy keren wrote:
>> Erez D wrote:
>>> hi
>>>
>>> hi do i do atomic operations in linux (userspace) ?
>>>
>>> i need somthing like testAndSet32()
>>>
>>>
>>> thanks,
>>> erez.
>>
>> you need to use inline assembly to do this.
>>
>> it looks like glib has support for atomic operation (thought i've never
>> used it).
>>
>> also, g++ seems to have support for atomic operations,as a non-standard
>> extention.
>>
> 
> Just about any threads library (pthreads, boost, wxwidgets) should have 
> atomic opration support (at least critical sections and mutexes). Not 
> sure if that is what you want though

these are not "atomic operations" in the sense he needs (atomic set and 
get) - these are mutexes - and they are much slower then atomic operations.

--guy




More information about the Linux-il mailing list