2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 pthread_cond_init(&cond, NULL);
26 pthread_mutex_init(&condMutex, NULL);
31 pthread_cond_destroy(&cond);
32 pthread_mutex_destroy(&condMutex);
40 pthread_mutex_lock(&condMutex);
41 pthread_cond_signal(&cond);
42 pthread_mutex_unlock(&condMutex);
44 #error "Not ported yet"
48 void Signal::waitForSignal()
51 pthread_mutex_lock(&condMutex);
52 pthread_cond_wait(&cond, &condMutex);
53 pthread_mutex_unlock(&condMutex);
55 #error "Not ported yet"
59 void Signal::waitForSignalTimed(struct timespec* ts)
62 pthread_mutex_lock(&condMutex);
63 pthread_cond_timedwait(&cond, &condMutex, ts);
64 pthread_mutex_unlock(&condMutex);
66 #error "Not ported yet"
70 void Signal::waitForSignalTimed(unsigned int ts)
72 struct timespec target_time;
73 clock_gettime(CLOCK_REALTIME,&target_time);
74 target_time.tv_nsec+=1000000LL*ts;
75 if (target_time.tv_nsec>999999999) {
76 target_time.tv_nsec-=1000000000L;
77 target_time.tv_sec+=1;
79 waitForSignalTimed(&target_time);