problem with pthread_mutex_timedlock



Hello,

I want to use this function to lock a resource, but with a timeout

and that is the problem, the function returns immediately after calling, and if the lock was not free, it returns the error code 110, but I have no idea what this error code means, I've found nothing in the man-pages or anywhere else

Can anyone help me?

I'm using 2.6.15 under a special glibc/busybox distribution for an arm9-core, but I have the same effect under Kubuntu 6.06


here is my code:
-------------------------------------
struct timespec deltatime;
deltatime.tv_sec = 3;
deltatime.tv_nsec = 0;

int err_code = pthread_mutex_timedlock( &_mutexLogfile, &deltatime );


if (err_code != 0)
{

cout << "Locking returns " << err_code << endl;
THROW_EX("Logfile Mutex locked!");

}

---------------------------------------

Thank you in advance!

Hans
.



Relevant Pages

  • Re: problem with pthread_mutex_timedlock
    ... I want to use this function to lock a resource, but with a timeout ... and if the lock was not free, it returns the error code 110, but I have ...
    (comp.os.linux.development.apps)
  • Re: Synchronization exception
    ... That's the error you get if you try call a method that requires the calling thread to own the synchronization object when the calling thread doesn't actually own the synchronization object. ... It has some bugs (a synchronization bug in the setter, and both the getter and setter may return without releasing the lock, if an exception were to occur...the latter bug being more an issue in the setter where you call to another method). ...
    (microsoft.public.dotnet.framework)
  • Re: New "timeout" api, to replace callout
    ... Timer expires on active session but source of timer was just ... time has expired and it is ready to run, once its lock gets freed. ... disable or cleanup the timeout. ...
    (freebsd-arch)
  • Re: Resolving race conditions with callbacks and cancellation?
    ... callback could be called after cancel call completes. ... The callback must be to the state-machine inside the lock. ... The state is 'Eidle' and so this event causes an action routine to be called that changes the object SM state to 'EreadWithTimeout', stores N inside the object, queues the object to the timeout thread, unlocks the SM and makes the read call, where the thread driving the object gets blocked. ...
    (comp.programming.threads)
  • Re: New "timeout" api, to replace callout
    ... only ever grab the specified lock when it calls the timeout function. ... My plan is to use non-blocking grabs of the timeouts lock to get ... When a timeouts timer expires, the thread that services the timeouts ...
    (freebsd-arch)