Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SbThreadSignal.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Nicolas DAGUISE (May 2007)
22**=======================================================================*/
23
24
25#ifndef SB_THREAD_SIGNAL_H
26#define SB_THREAD_SIGNAL_H
27
28#include <Inventor/sys/port.h>
29#include <Inventor/SbBase.h>
30
31#include <Inventor/threads/SbThreadSpinlock.h>
32
33class SbThreadMutex;
34
35#if !defined (WIN32)
36#include <pthread.h>
37#endif
38
65{
66public:
67
72
77
81 void signalOne( );
82
87 void signalAll( );
88
94 void wait( );
95
101 SbBool trywait( const unsigned int timeout_ms );
102
103private:
104 SbThreadMutex* m_signalMtx;
105
106#if defined(_WIN32)
107 HANDLE m_events[2];
108 uint32_t m_waitersCount;
109 SbThreadSpinlock m_spinlock;
110
111#elif defined (__linux__) || defined(__APPLE__)
112 pthread_cond_t m_event;
113 bool m_automatic;
114 bool m_active;
115
116#else
117 // Not implemented yet.
118#endif
119};
120
121#endif // SB_THREAD_SIGNAL_H
122
123
124
125
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable signal ...
void wait()
Waits for a signal notification.
SbBool trywait(const unsigned int timeout_ms)
Waits for a signal notification or timeout milliseconds have elapsed.
void signalAll()
Signals all threads that are waiting on this object.
void signalOne()
Signals one thread that is waiting on this object.
~SbThreadSignal()
Destructor.
SbThreadSignal(SbThreadMutex *mtx)
Constructor.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable spinloc...
int SbBool
Boolean type.
Definition SbBase.h:87