NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
ndicapi_thread.h
Go to the documentation of this file.
1 /*=======================================================================
2 
3  Program: NDI Combined API C Interface Library
4  Module: $RCSfile: ndicapi_thread.h,v $
5  Creator: David Gobbi <dgobbi@atamai.com>
6  Language: C
7  Author: $Author: dgobbi $
8  Date: $Date: 2005/07/01 22:52:05 $
9  Version: $Revision: 1.3 $
10 
11 ==========================================================================
12 
13 Copyright (c) 2000-2005 Atamai, Inc.
14 
15 Use, modification and redistribution of the software, in source or
16 binary forms, are permitted provided that the following terms and
17 conditions are met:
18 
19 1) Redistribution of the source code, in verbatim or modified
20  form, must retain the above copyright notice, this license,
21  the following disclaimer, and any notices that refer to this
22  license and/or the following disclaimer.
23 
24 2) Redistribution in binary form must include the above copyright
25  notice, a copy of this license and the following disclaimer
26  in the documentation or with other materials provided with the
27  distribution.
28 
29 3) Modified copies of the source code must be clearly marked as such,
30  and must not be misrepresented as verbatim copies of the source code.
31 
32 THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS"
33 WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
34 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35 PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY
36 MODIFY AND/OR REDISTRIBUTE THE SOFTWARE UNDER THE TERMS OF THIS LICENSE
37 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
38 (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BECOMING INACCURATE
39 OR LOSS OF PROFIT OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF
40 THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE
41 POSSIBILITY OF SUCH DAMAGES.
42 
43 =======================================================================*/
44 
50 #ifndef NDICAPI_THREAD_H
51 #define NDICAPI_THREAD_H 1
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /*=====================================================================*/
64 #ifdef _WIN32
65 
66 #include <windows.h>
67 #include <winbase.h>
68 #include <sys/timeb.h>
69 
70 typedef HANDLE NDIThread;
71 typedef HANDLE NDIMutex;
72 typedef HANDLE NDIEvent;
73 
74 #elif defined(unix) || defined(__unix__) || defined(__APPLE__)
75 
76 #include <unistd.h>
77 #include <sys/types.h>
78 #include <sys/stat.h>
79 #include <sys/time.h>
80 #include <errno.h>
81 #include <pthread.h>
82 
83 typedef struct {
84  int signalled;
85  pthread_cond_t cond;
86  pthread_mutex_t mutex;
87 } pl_cond_and_mutex_t;
88 typedef pthread_t NDIThread;
89 typedef pthread_mutex_t *NDIMutex;
90 typedef pl_cond_and_mutex_t *NDIEvent;
91 
92 #endif
93 
94 NDIMutex ndiMutexCreate();
95 void ndiMutexDestroy(NDIMutex mutex);
96 void ndiMutexLock(NDIMutex mutex);
97 void ndiMutexUnlock(NDIMutex mutex);
98 
99 NDIEvent ndiEventCreate();
100 void ndiEventDestroy(NDIEvent event);
101 void ndiEventSignal(NDIEvent event);
102 int ndiEventWait(NDIEvent event, int milliseconds);
103 
104 NDIThread ndiThreadSplit(void *thread_func(void *userdata), void *userdata);
105 void ndiThreadJoin(NDIThread thread);
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* NDICAPI_THREAD_H */
void ndiMutexLock(NDIMutex mutex)
NDIEvent ndiEventCreate()
NDIMutex ndiMutexCreate()
void ndiThreadJoin(NDIThread thread)
int ndiEventWait(NDIEvent event, int milliseconds)
void ndiEventSignal(NDIEvent event)
void ndiMutexUnlock(NDIMutex mutex)
cl_event event
Definition: glew.h:3231
NDIThread ndiThreadSplit(void *thread_func(void *userdata), void *userdata)
void ndiMutexDestroy(NDIMutex mutex)
void ndiEventDestroy(NDIEvent event)
typedef HANDLE(WINAPI *PFNWGLCREATEBUFFERREGIONARBPROC)(HDC hDC