This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: how to get mutex owner?


> -----Original Message-----
> From: Boris V. Guzhov [mailto:borg@int.spb.ru]
> Subject: Re: [ECOS] how to get mutex owner?
> 
> I think that following code is true.
> 
> cyg_mutex_t mutex;
> ...
>  if ( mutex.owner == (cyg_thread *)cyg_thread_self() )
> {
>     //  This thread is the mutex owner
> }

I'm in plain C. So I don't think this type conversion is very good. It
should work in C++ maybe.

But instead I finally used:
 if ( mutex.owner->unique_id == cyg_thread_self() )

Thanks

A+
-- 
Fabrice Gautier
fabrice_gautier@sdesigns.com 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]