Re: Assertion failed: (false), function pluginThreadEntry

Erik Johansson <[email protected]> Tue, 20 Dec 2011 19:46:51 +0100
Newsgroups gmane.network.licq.general
Message-ID <CAAMKmofeBZVuk6JQnmePThzO=e5XD7WifDs1vLWM40uLRBMZeQ@mail.gmail.com>
On Tue, Dec 20, 2011 at 12:45, George L. Yermulnik <[email protected]> wrote:
> state=2
> state=3
> state=2
> state=3
> state=2
> state=3
> state=1
> Assertion failed: (false), function pluginThreadEntry, file /usr/ports/WORK/usr/ports/net-im/licq/work/licq-1.5.1/src/plugins/pluginthread.cpp, line 85.

After googling a bit I realize that my assumption that
pthread_cond_wait() only returns due to a call to
pthread_cond_signal() or pthread_cond_broadcast() is wrong. According
to http://lists.freebsd.org/pipermail/freebsd-hackers/2011-February/034573.html
pthread_cond_wait() can return for no apparent reason.

Please try the patch below and see if it fixes the problem for you:

diff --git a/licq/src/plugins/pluginthread.cpp
b/licq/src/plugins/pluginthread.cpp
index 0a4f249..90d8a7c 100644
--- a/licq/src/plugins/pluginthread.cpp
+++ b/licq/src/plugins/pluginthread.cpp
@@ -73,7 +73,10 @@ static void* pluginThreadEntry(void* arg)

   while (data.myState == PluginThread::Data::STATE_WAITING)
   {
-    data.myCondition.wait(data.myMutex);
+    do
+    {
+      data.myCondition.wait(data.myMutex);
+    } while (data.myState == PluginThread::Data::STATE_WAITING);

     switch (data.myState)
     {


// Erik

-- 
Erik Johansson
Home Page: http://ejohansson.se/
PGP Key: http://ejohansson.se/erik.asc