atomic operations under linux

atomic operations under linux

Erez D erez0001 at gmail.com
Thu Dec 10 14:48:54 IST 2009


On Wed, Dec 9, 2009 at 10:35 PM, Micha <michf at post.tau.ac.il> 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
>
>
i was porting some code from windows to linux and they used atomic test and
set, so i wanted to replace that with similiar linux code.

however, in the end i removed all this code and replaced the higher class
with pthread_spin_lock and unlock


thanks
erez.


>
>> --guy
>>
>>
>> _______________________________________________
>> Linux-il mailing list
>> Linux-il at cs.huji.ac.il
>> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>>
>
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20091210/0aab23b8/attachment.html>


More information about the Linux-il mailing list