Am 05.04.2017 um 16:25 schrieb Branko Čibej:
On 05.04.2017 14:16, Jim Jagielski wrote:
Hmmm.... Looking over the timed stuff, it seems that semtimedop()
is used incorrectly.
For both pthread_mutex_timedlock() and sem_timedwait(), the
timeout variable is the actual wallclock time that the wait
expires (eg: now+5mins). But, from what I can read about semtimedop(), its
timeout really is a timeout (5mins). But it seems that we use it
as if it was wall-clock time, which is WAY wrong...
Can someone check to see what exactly the timeout value is for
semtimedop()? Is it a delta or a wall-clock?
My man page says:
semtimedop() behaves identically to semop() except that in those
cases where the calling thread would sleep, the duration of that
sleep is limited by the amount of elapsed time specified by the
timespec structure whose address is passed in the timeout argument.
Looks like delta to me.
Solaris man page. Those are typically good:
The semtimedop() function behaves as semop() except when it
must suspend execution of the calling process to complete
its operation. If semtimedop() must suspend the calling
process after the time interval specified in timeout
^^^^^^^^^^^^^^
expires, or if the timeout expires while the process is
suspended, semtimedop() returns with an error. If the
timespec structure pointed to by timeout is zero-valued and
semtimedop() needs to suspend the calling process to com-
plete the requested operation(s), it returns immediately
with an error. If timeout is the NULL pointer, the behavior
of semtimedop() is identical to that of semop().
So they speak of a timeout interval, which also makes "delta" the likely
interpretation.
Rainer