1 /* Condition variables for multithreading.
2 Copyright (C) 2008 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 /* Written by Yoann Vandoorselaere <yoann@prelude-ids.org>, 2008. */
22 #include "glthread/cond.h"
24 /* ========================================================================= */
28 /* -------------------------- gl_cond_t datatype -------------------------- */
31 glthread_cond_timedwait_multithreaded (gl_cond_t *cond,
33 struct timespec *abstime)
38 ev = pth_event (PTH_EVENT_TIME, pth_time (abstime->tv_sec, abstime->tv_nsec / 1000));
39 ret = pth_cond_await (cond, lock, ev);
41 status = pth_event_status (ev);
42 pth_event_free (ev, PTH_FREE_THIS);
44 if (status == PTH_STATUS_OCCURRED)
52 /* ========================================================================= */
54 #if USE_SOLARIS_THREADS
56 /* -------------------------- gl_cond_t datatype -------------------------- */
59 glthread_cond_timedwait_multithreaded (gl_cond_t *cond,
61 struct timespec *abstime)
65 ret = cond_timedwait (cond, lock, abstime);
73 /* ========================================================================= */