From 162b0b292322cd773bfdbfa9f6036e1b2c234335 Mon Sep 17 00:00:00 2001 From: prascle Date: Fri, 9 Dec 2005 18:26:01 +0000 Subject: [PATCH] PR: check return on sem_wait: interruptible by signal --- src/SALOMELocalTrace/LocalTraceBufferPool.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx index 4523a897d..c7d321ec6 100644 --- a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx +++ b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx @@ -169,7 +169,12 @@ int LocalTraceBufferPool::insert(int traceType, const char* msg) // wait until there is a free buffer in the pool - int ret = sem_wait(&_freeBufferSemaphore); + int ret = -1; + while (ret) + { + ret = sem_wait(&_freeBufferSemaphore); + if (ret) perror(" LocalTraceBufferPool::insert, sem_wait"); + } // get the next free buffer available (mutex protected) @@ -209,7 +214,12 @@ int LocalTraceBufferPool::retrieve(LocalTrace_TraceInfo& aTrace) // wait until there is a buffer in the pool, with a message to print - int ret = sem_wait(&_fullBufferSemaphore); + int ret = -1; + while (ret) + { + ret = sem_wait(&_fullBufferSemaphore); + if (ret) perror(" LocalTraceBufferPool::retrieve, sem_wait"); + } // get the next buffer to print -- 2.39.2