[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rtl] protect



liangjiangang@netease.com wrote:
> 
> How can i protect some resource from accessed by two thread in the same time.
> what is the counterpart function as waitforsingleobject() under windows. a short
> pieces of codes will be appreciated
> 
> thanks a lot

You need to use a mutex.  Under RTAI you can use the conventional
pthread_mutex_lock and pthread_mutex_unlock.  As always, be very careful
with your design as mutex_lock, could easily be mutex_deadlock :-)

Regards, Stuart