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.
23 // well, I say fix... Delete me.
28 pthread_cond_init(&cond, NULL);
29 pthread_mutex_init(&condMutex, NULL);
34 pthread_cond_destroy(&cond);
35 pthread_mutex_destroy(&condMutex);
43 pthread_mutex_lock(&condMutex);
44 pthread_cond_signal(&cond);
45 pthread_mutex_unlock(&condMutex);
47 #error "Not ported yet"
51 void Signal::waitForSignal()
54 pthread_mutex_lock(&condMutex);
55 pthread_cond_wait(&cond, &condMutex);
56 pthread_mutex_unlock(&condMutex);
58 #error "Not ported yet"
62 void Signal::waitForSignalTimed(struct timespec* ts)
65 pthread_mutex_lock(&condMutex);
66 pthread_cond_timedwait(&cond, &condMutex, ts);
67 pthread_mutex_unlock(&condMutex);
69 #error "Not ported yet"
73 void Signal::waitForSignalTimed(unsigned int ts)
75 struct timespec target_time;
76 clock_gettime(CLOCK_REALTIME,&target_time);
77 target_time.tv_nsec+=1000000LL*ts;
78 if (target_time.tv_nsec>999999999) {
79 target_time.tv_nsec-=1000000000L;
80 target_time.tv_sec+=1;
82 waitForSignalTimed(&target_time);