// acquire a local semaphore for reading try { localSem->AcquireShared(); } catch (const TSemaphoreException&) { // handle exception... }// acquire a recoverable semaphore for reading try { recoverableSem->AcquireShared(); } catch (const TSemaphoreException&) { // handle exception... }
// acquire a local semaphore for writing try { localSem->Acquire(); } catch (const TSemaphoreException&) { // handle exception... }// acquire a recoverable semaphore for writing try { recoverableSem->Acquire(); } catch (const TSemaphoreException&) { //handle exception... }
Acquire()
or AcquireShared()
. If this period expires before the semaphore becomes available, the acquire function throws a TTimeOutException with an error value of kTimeExpired
.