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]
Other format: [Raw text]

Re: Re: mutex and mailbox query


On Sat, Sep 20, 2003 at 09:18:18PM +0200, Savin Zlobec wrote:
> 
> Hans Dermot Doran wrote:
> 
> > Hello all,
> >
> > is it possible for a thread to destroy a mutex it has previously locked ?
> > or does it have to be unlocked first ?
> >
> >As part of a thread-shutdown routine, I want to destroy a mailbox whose
> >messages are in shared memory, therefore I mutex the messages, destroy the
> >mailbox, destroy the shared memory and release threads waiting on the mutex
> >and then destroy it ... all in one go ...
> 
> If you destroy the mutex, it should not be locked and have no threads
> waiting on it. You should do your routine with scheduler locked and
> unlock the mutex before you destroy it.

Problem is, you have no way of knowing if any threads are waiting on
the mbox or the mutex. There are no API calls to tell you this. 

    Andrew

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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