Re: Mutex, for static objects

Kevin Atkinson <[email protected]>
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <Pine.LNX.4.44.0410261046110.1559-100000@kevin-p3.atkinson.dhs.org>
On Tue, 26 Oct 2004, Gary Setter wrote:

> However, what if making a mutex fails after main is called? What should
> be done? How can the program determine if the failure is legitimate?
> ...
> Does the unix version of aspell have the same situation? What
> should be done when an attempt to lock via a mutex fails? Are
> there other ways the code could be improved?

The making of a mutex SHOULD NOT fail.  If it does the appropriate action 
is to abort.  Locking a mutex should also always succeed.  If some object 
is already holding the lock than the call to lock the mutex should block 
until the lock is released.

-- 
http://kevin.atkinson.dhs.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.