EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

<20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: POSIX recursive mutex
From: Marty Kraimer <[email protected]>
To: Jeff Hill <[email protected]>
Cc: "'Johnson, Andrew N.'" <[email protected]>, [email protected]
Date: Tue, 03 Dec 2002 08:07:18 -0600
Jeff Hill wrote:
With the win32 implementation of epicsMutex I solved this problem as
follows.

I am missing something. Since WaitForSingleObject accepts a timeout argument why cant epicsMutexLockWithTimeout mjust be:

epicsMutexLockWithTimeout(epicsMutexId pSem, double timeOut )
{
    /* convert timeOut to tmo */
    status = WaitForSingleObject ( pSem->os.mutex, tmo );
    ...
}

In any case your solution requires that WaitForSingleObject include a timeout argument.

Thus I still dont see any posix alternative to

timeleft = timeout;
while(timeleft>0.0) {
     if(pthread_mutex_trylock(...)==success) break;
     epicsThreadSleep(shortTime);
     timeleft -= shortTime;
}


Your second message was
Jeff Hill wrote:
> AFAICT these are the only two places in all of base that call
> epicsMutexLockWithTimeout(). They are both associated with diagnostics
> which I presume need to timeout when a lock isn't available because of a
> system failure.
>
>
> D:\users\hill\epicsDvl\epics\base\src\db\dbLock.c(561):
>     lockSetModifyLockStatus =
> epicsMutexLockWithTimeout(lockSetModifyLock,5.0);
>
> D:\users\hill\epicsDvl\epics\base\src\db\dbNotify.c(395):
>     lockStatus = epicsMutexLockWithTimeout(notifyLock,2.0);
>

The first is only used when links are being dynamically modified. The second is only for diagnostics. Thus base is OK. Again my proposed solution does bother me since it could cause a lot of thread context switches.

Marty


Replies:
RE: POSIX recursive mutex Jeff Hill
References:
RE: POSIX recursive mutex Jeff Hill

Navigate by Date:
Prev: epicsMutexLockWithTimeout - where is it called Jeff Hill
Next: Re: POSIX recursive mutex Marty Kraimer
Index: <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: POSIX recursive mutex Jeff Hill
Next: RE: POSIX recursive mutex Jeff Hill
Index: <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·