Re: Posix mutex working in Linux but not Solaris Here it is:
bool
posixMutex::isProcessLocked() const
{
return (m_lockingProcessID == getThisProcessID() &
m_state.m_lockCount != 0);
}
So what else should it check in your opinion? Thank you.
On Feb 8, 4:24*pm, Frank Cusack <fcus...@fcusack.com> wrote:
> On Fri, 8 Feb 2008 15:26:50 -0800 (PST) Cheng <cheng.still...@gmail.com> wrote:
>
> > -lpthread and -lthread are both used in linking. I debugged a little
> > bit more by printing some info:
>
> > void
> > posixMutex::lock()
> > {
> ...
> > * * // This is the correct order to set these in to avoid a race-
> > condition
> > * * // with the test above the lock call...
>
> > * * m_state.m_lockedBy = thisthreadID;
> > * * m_state.m_lockCount = 1;
> > * * m_lockingProcessID = getThisProcessID();
>
> the comment is incorrect. *there is NO ordering which either
> introduces or avoids a race. *show us isProcessLocked(). *i bet
> it merely checks m_lockingProcessID. *if so, that's your race.
>
> -frank |