bool FX::QMutex::tryLock (  )  [inherited]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

For FOX compatibility

Definition at line 753 of file int_QMutexImpl.h.

References FX::FXAtomicInt::fdec(), FX::FXAtomicInt::finc(), FX::QThread::id(), FX::QMutexPrivate::lockCount, FX::QMutexPrivate::recurseCount, and FX::QMutexPrivate::threadId.

00754 {
00755 #ifndef FXDISABLE_THREADS
00756 #ifdef USE_OURMUTEX
00757     FXulong myid=QThread::id();
00758     if(!p->lockCount.finc())
00759     {   // Nothing owns me
00760         assert(p->threadId==0);
00761         p->threadId=myid;
00762         p->recurseCount=1;
00763         return true;
00764     }
00765     else
00766     {   // Restore
00767         if(p->threadId==myid)
00768         {   // Recurse
00769             p->recurseCount++;
00770             return true;
00771         }
00772         // Restore
00773         p->lockCount.fdec();
00774         return false;
00775     }
00776 #elif defined(USE_POSIX)
00777 
00778     if(0==pthread_mutex_trylock(&p->m->wo))
00779         return true;
00780     else
00781         return false;
00782 #endif
00783 #endif
00784 }


(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:38:02 2009 for TnFOX by doxygen v1.4.7