bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can't release mutex


From: Wakan
Subject: can't release mutex
Date: Sat, 27 Jan 2007 16:18:26 +0100
User-agent: Mozilla Thunderbird 1.5.0.9 (Windows/20061207)

Hi,
I'm using commoncpp library in a project that includes a multithread server that
can accept many tcp connection and each connection generates a thread.
In this server I'm using a thirdy party proprietary library (compiled), that (as the producer says)
can't work in multithread environment.
As each connection thread needs to call functions of this thirdy party library, I've used a mutex to protect the piece of
code where this external library function is called.
In this way I can use this library fine, because all calls are serialized and the protected function is called by one thread each time.
This is an example:
...
   while(1) {
       if(isPending(pendingInput)) {
               mutex.enterMutex();
---> protected function call (a function that can't work in multithread env) <--- mutex.leaveMutex();
      }
   }
...
in 99% of cases it works fine. But it accidentally happens that a thread can't exit from the mutex
maybe because the thirdy party function freezes itself.
When this happens, the server can accept other connections, soit still works, but each thread can't enter in the mutex proteced piece of code. I'm thinking about something, like a timeout, that exits the mutex after a time, if the thread is not exiting...
Can someone help me to resolve this problem? Are there other solutions?
Thanks in advance,
Regards
Carlo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]