aspell-devel
[Top][All Lists]
Advanced

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

Re: [aspell-devel] Mutex, for static objects


From: Kevin Atkinson
Subject: Re: [aspell-devel] Mutex, for static objects
Date: Thu, 28 Oct 2004 09:00:20 -0600 (MDT)

On Thu, 28 Oct 2004, Gary Setter wrote:

> > Because there is NO REASON FOR IT TO FAIL.  It is perfectly legal to call
> > these before main is called.  I don't know why you are having a problem.

> This seems like an odd response from someone who has programed
> for awhile on several systems. Unexpected things do happen.
> Anticipating errors and handling them properly is a major part of
> software development.  Not checking for failure because you can't
> imagine why it would fail is bad judgment. Talk to a professor or
> a mentor about this.

Please do not tell me how to program.  I have a good understanding of when 
these functions can fail and I know that they DO NOT unless something is 
REALLY wrong (like out of memory).  Thus I do not bother to check the 
return value.

> > IN fact the manual states that "pthread_mutex_init always returns 0."  The
> > other ones will only fail if they are error checking mutexes, which they
> > are not.
> >
> > Attached in a version of lock.hpp which does check the return value.  I
> > ran it with no problem, just as I thought.
> >
> The code is conditionally compiled. If you used make and your
> makefile defined USE_POSIX_MUTEX, then you were right and I have
> my answer. Just to be kind would you please verify that
> USE_POSIX_MUTEX  was defined and that the first rendition of
> Mutex was compiled?

Yes I am sure.

> Do you know you have a valid valid in Mutex::l_ ?

Hu?

> > > The solution to the mutex creation on Windows problem is most
> > > likely elimination of the global vars. I would be much more
> > > interested in putting the effort to make that work if elimination
> > > of the globals is also your goal. Is it?
> >
> > NO.  As there is no reason to.
> >
> Except that global vars are generally a bad thing and that it is
> a hang up for making the code both portable and rigerous.

There are some cases when it is perfectly valid to use global values, 
such as for caches.  This is the case here.  Please do not tell me how to 
program.

-- 
http://kevin.atkinson.dhs.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]