Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Re-evaluate predicate after returning from condition wait

This is needed because pthread_cond_wait() can wake up for no apparent reason
(i.e. not due to a call to pthread_cond_signal() or
pthread_cond_broadcast()). See [1]. Should hopefully solve #18.

[1] - http://lists.freebsd.org/pipermail/freebsd-hackers/2011-February/034573.html
  • Loading branch information...
commit 2f25b63d4393620d5b3cf1cc9505b34055588dee 1 parent 0a77275
@erijo erijo authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 licq/src/plugin/pluginthread.cpp
View
7 licq/src/plugin/pluginthread.cpp
@@ -1,6 +1,6 @@
/*
* This file is part of Licq, an instant messaging client for UNIX.
- * Copyright (C) 2010 Licq developers
+ * Copyright (C) 2010-2011 Licq developers
*
* Licq is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -86,7 +86,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)
{
Please sign in to comment.
Something went wrong with that request. Please try again.