aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/ha/ha_segments.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-01-20 15:52:29 +0100
committerMartin Willi <martin@revosec.ch>2011-01-20 15:52:29 +0100
commit60b71def1ac83ca36946a2d4273d7bdbe4e56d74 (patch)
treec990afd74aeb7a113ebd00e843844cb0a860776a /src/libcharon/plugins/ha/ha_segments.c
parent44b6b8f9d56e6042599aa9f0a96414de7fc97492 (diff)
downloadstrongswan-60b71def1ac83ca36946a2d4273d7bdbe4e56d74.tar.bz2
strongswan-60b71def1ac83ca36946a2d4273d7bdbe4e56d74.tar.xz
Use wrapped threading functions in ha plugin
Diffstat (limited to 'src/libcharon/plugins/ha/ha_segments.c')
-rw-r--r--src/libcharon/plugins/ha/ha_segments.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/libcharon/plugins/ha/ha_segments.c b/src/libcharon/plugins/ha/ha_segments.c
index 19e0f692e..7c7bef851 100644
--- a/src/libcharon/plugins/ha/ha_segments.c
+++ b/src/libcharon/plugins/ha/ha_segments.c
@@ -15,11 +15,10 @@
#include "ha_segments.h"
-#include <pthread.h>
-
#include <threading/mutex.h>
#include <threading/condvar.h>
#include <utils/linked_list.h>
+#include <threading/thread.h>
#include <processing/jobs/callback_job.h>
#define DEFAULT_HEARTBEAT_DELAY 1000
@@ -255,16 +254,15 @@ METHOD(listener_t, alert_hook, bool,
*/
static job_requeue_t watchdog(private_ha_segments_t *this)
{
- int oldstate;
- bool timeout;
+ bool timeout, oldstate;
this->mutex->lock(this->mutex);
- pthread_cleanup_push((void*)this->mutex->unlock, this->mutex);
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
+ thread_cleanup_push((void*)this->mutex->unlock, this->mutex);
+ oldstate = thread_cancelability(TRUE);
timeout = this->condvar->timed_wait(this->condvar, this->mutex,
this->heartbeat_timeout);
- pthread_setcancelstate(oldstate, NULL);
- pthread_cleanup_pop(TRUE);
+ thread_cancelability(oldstate);
+ thread_cleanup_pop(TRUE);
if (timeout)
{
DBG1(DBG_CFG, "no heartbeat received, taking all segments");