NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Thread.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2011, NVIDIA Corporation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of NVIDIA Corporation nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #include "base/Thread.hpp"
29 
30 using namespace FW;
31 
32 //------------------------------------------------------------------------
33 
34 Spinlock Thread::s_lock;
35 Hash<U32, Thread*> Thread::s_threads;
36 Thread* Thread::s_mainThread = NULL;
37 
38 //------------------------------------------------------------------------
39 
41 {
42  InitializeCriticalSection(&m_critSect);
43 }
44 
45 //------------------------------------------------------------------------
46 
48 {
49  DeleteCriticalSection(&m_critSect);
50 }
51 
52 //------------------------------------------------------------------------
53 
54 void Spinlock::enter(void)
55 {
56  EnterCriticalSection(&m_critSect);
57 }
58 
59 //------------------------------------------------------------------------
60 
61 void Spinlock::leave(void)
62 {
63  LeaveCriticalSection(&m_critSect);
64 }
65 
66 //------------------------------------------------------------------------
67 
68 Semaphore::Semaphore(int initCount, int maxCount)
69 {
70  m_handle = CreateSemaphore(NULL, initCount, maxCount, NULL);
71  if (!m_handle)
72  failWin32Error("CreateSemaphore");
73 }
74 
75 //------------------------------------------------------------------------
76 
78 {
79  CloseHandle(m_handle);
80 }
81 
82 //------------------------------------------------------------------------
83 
84 bool Semaphore::acquire(int millis)
85 {
86  DWORD res = WaitForSingleObject(m_handle, (millis >= 0) ? millis : INFINITE);
87  if (res == WAIT_FAILED)
88  failWin32Error("WaitForSingleObject");
89  return (res == WAIT_OBJECT_0);
90 }
91 
92 //------------------------------------------------------------------------
93 
95 {
96  if (!ReleaseSemaphore(m_handle, 1, NULL))
97  failWin32Error("ReleaseSemaphore");
98 }
99 
100 //------------------------------------------------------------------------
101 
103 : m_ownerSem (1, 1),
104  m_waitSem (0, 1),
105  m_notifySem (0, 1),
106  m_ownerThread (0),
107  m_enterCount (0),
108  m_waitCount (0)
109 {
110  InitializeCriticalSection(&m_mutex);
111  if (isAvailable_InitializeConditionVariable())
112  InitializeConditionVariable(&m_condition);
113 }
114 
115 //------------------------------------------------------------------------
116 
118 {
119  DeleteCriticalSection(&m_mutex);
120 }
121 
122 //------------------------------------------------------------------------
123 
124 void Monitor::enter(void)
125 {
126  if (isAvailable_InitializeConditionVariable())
127  {
128  EnterCriticalSection(&m_mutex);
129  }
130  else
131  {
132  U32 currThread = Thread::getID();
133 
134  m_lock.enter();
135  if (m_ownerThread != currThread || !m_enterCount)
136  {
137  m_lock.leave();
138  m_ownerSem.acquire();
139  m_lock.enter();
140  }
141 
142  m_ownerThread = currThread;
143  m_enterCount++;
144  m_lock.leave();
145 }
146 }
147 
148 //------------------------------------------------------------------------
149 
150 void Monitor::leave(void)
151 {
152  if (isAvailable_InitializeConditionVariable())
153  {
154  LeaveCriticalSection(&m_mutex);
155  }
156  else
157  {
158  FW_ASSERT(m_ownerThread == Thread::getID() && m_enterCount);
159  m_enterCount--;
160  if (!m_enterCount)
161  m_ownerSem.release();
162 }
163 }
164 
165 //------------------------------------------------------------------------
166 
167 void Monitor::wait(void)
168 {
169  if (isAvailable_InitializeConditionVariable())
170  {
171  SleepConditionVariableCS(&m_condition, &m_mutex, INFINITE);
172  }
173  else
174  {
175  FW_ASSERT(m_ownerThread == Thread::getID() && m_enterCount);
176  U32 currThread = m_ownerThread;
177  int enterCount = m_enterCount;
178 
179  m_waitCount++;
180  m_enterCount = 0;
181  m_ownerSem.release();
182 
183  m_waitSem.acquire();
184  m_waitCount--;
185  m_notifySem.release();
186 
187  m_ownerSem.acquire();
188  m_lock.enter();
189  m_ownerThread = currThread;
190  m_enterCount = enterCount;
191  m_lock.leave();
192 }
193 }
194 
195 //------------------------------------------------------------------------
196 
197 void Monitor::notify(void)
198 {
199  if (isAvailable_InitializeConditionVariable())
200  {
201  WakeConditionVariable(&m_condition);
202  }
203  else
204  {
205  FW_ASSERT(m_ownerThread == Thread::getID() && m_enterCount);
206  if (m_waitCount)
207  {
208  m_waitSem.release();
209  m_notifySem.acquire();
210  }
211 }
212 }
213 
214 //------------------------------------------------------------------------
215 
217 {
218  if (isAvailable_InitializeConditionVariable())
219  {
220  WakeAllConditionVariable(&m_condition);
221  }
222  else
223  {
224  FW_ASSERT(m_ownerThread == Thread::getID() && m_enterCount);
225  while (m_waitCount)
226  {
227  m_waitSem.release();
228  m_notifySem.acquire();
229  }
230 }
231 }
232 
233 //------------------------------------------------------------------------
234 
236 : m_refCount (0),
237  m_id (0),
238  m_handle (NULL),
239  m_priority (Priority_Normal)
240 {
241 }
242 
243 //------------------------------------------------------------------------
244 
246 {
247  // Wait and exit.
248 
249  if (this != getCurrent())
250  join();
251  else
252  {
253  failIfError();
254  refer();
255  m_exited = true;
256  unrefer();
257  }
258 
259  // Deinit user data.
260 
261  for (int i = m_userData.firstSlot(); i != -1; i = m_userData.nextSlot(i))
262  {
263  const UserData& data = m_userData.getSlot(i).value;
264  if (data.deinitFunc)
265  data.deinitFunc(data.data);
266  }
267 }
268 
269 //------------------------------------------------------------------------
270 
271 void Thread::start(ThreadFunc func, void* param)
272 {
273  m_startLock.enter();
274  join();
275 
276  StartParams params;
277  params.thread = this;
278  params.userFunc = func;
279  params.userParam = param;
280  params.ready.acquire();
281 
282  if (!CreateThread(NULL, 0, threadProc, &params, 0, NULL))
283  failWin32Error("CreateThread");
284 
285  params.ready.acquire();
286  m_startLock.leave();
287 }
288 
289 //------------------------------------------------------------------------
290 
292 {
293  s_lock.enter();
294  Thread** found = s_threads.search(getID());
295  Thread* thread = (found) ? *found : NULL;
296  s_lock.leave();
297 
298  if (!thread)
299  {
300  thread = new Thread;
301  thread->started();
302  }
303  return thread;
304 }
305 
306 //------------------------------------------------------------------------
307 
309 {
310  getCurrent();
311  return s_mainThread;
312 }
313 
314 //------------------------------------------------------------------------
315 
316 bool Thread::isMain(void)
317 {
318  Thread* curr = getCurrent();
319  return (curr == s_mainThread);
320 }
321 
322 //------------------------------------------------------------------------
323 
325 {
326  return GetCurrentThreadId();
327 }
328 
329 //------------------------------------------------------------------------
330 
331 void Thread::sleep(int millis)
332 {
333  Sleep(millis);
334 }
335 
336 //------------------------------------------------------------------------
337 
338 void Thread::yield(void)
339 {
340  SwitchToThread();
341 }
342 
343 //------------------------------------------------------------------------
344 
346 {
347  refer();
348  if (m_handle)
349  m_priority = GetThreadPriority(m_handle);
350  unrefer();
351 
352  if (m_priority == THREAD_PRIORITY_ERROR_RETURN)
353  failWin32Error("GetThreadPriority");
354  return m_priority;
355 }
356 
357 //------------------------------------------------------------------------
358 
359 void Thread::setPriority(int priority)
360 {
361  refer();
362  m_priority = priority;
363  if (m_handle && !SetThreadPriority(m_handle, priority))
364  failWin32Error("SetThreadPriority");
365  unrefer();
366 }
367 
368 //------------------------------------------------------------------------
369 
370 bool Thread::isAlive(void)
371 {
372  bool alive = false;
373  refer();
374 
375  if (m_handle)
376  {
377  DWORD exitCode;
378  if (!GetExitCodeThread(m_handle, &exitCode))
379  failWin32Error("GetExitCodeThread");
380 
381  if (exitCode == STILL_ACTIVE)
382  alive = true;
383  else
384  m_exited = true;
385  }
386 
387  unrefer();
388  return alive;
389 }
390 
391 //------------------------------------------------------------------------
392 
393 void Thread::join(void)
394 {
395  FW_ASSERT(this != getMain());
396  FW_ASSERT(this != getCurrent());
397 
398  refer();
399  if (m_handle && WaitForSingleObject(m_handle, INFINITE) == WAIT_FAILED)
400  failWin32Error("WaitForSingleObject");
401  m_exited = true;
402  unrefer();
403 }
404 
405 //------------------------------------------------------------------------
406 
407 void* Thread::getUserData(const String& id)
408 {
409  m_lock.enter();
410  UserData* found = m_userData.search(id);
411  void* data = (found) ? found->data : NULL;
412  m_lock.leave();
413  return data;
414 }
415 
416 //------------------------------------------------------------------------
417 
418 void Thread::setUserData(const String& id, void* data, DeinitFunc deinitFunc)
419 {
420  UserData oldData;
421  oldData.data = NULL;
422  oldData.deinitFunc = NULL;
423 
424  UserData newData;
425  newData.data = data;
426  newData.deinitFunc = deinitFunc;
427 
428  // Replace data.
429 
430  m_lock.enter();
431 
432  UserData* found = m_userData.search(id);
433  if (found)
434  {
435  oldData = *found;
436  *found = newData;
437  }
438 
439  if ((found != NULL) != (data != NULL || deinitFunc != NULL))
440  {
441  if (found)
442  m_userData.remove(id);
443  else
444  m_userData.add(id, newData);
445  }
446 
447  m_lock.leave();
448 
449  // Deinit old data.
450 
451  if (oldData.deinitFunc)
452  oldData.deinitFunc(oldData.data);
453 }
454 
455 //------------------------------------------------------------------------
456 
458 {
459  s_lock.enter();
460  for (int i = s_threads.firstSlot(); i != -1; i = s_threads.nextSlot(i))
461  {
462  Thread* thread = s_threads.getSlot(i).value;
463  thread->refer();
464  if (thread->m_handle && thread->m_id != getID())
465  SuspendThread(thread->m_handle);
466  thread->unrefer();
467  }
468  s_lock.leave();
469 }
470 
471 //------------------------------------------------------------------------
472 
473 void Thread::refer(void)
474 {
475  m_lock.enter();
476  m_refCount++;
477  m_lock.leave();
478 }
479 
480 //------------------------------------------------------------------------
481 
482 void Thread::unrefer(void)
483 {
484  m_lock.enter();
485  if (--m_refCount == 0 && m_exited)
486  {
487  m_exited = false;
488  exited();
489  }
490  m_lock.leave();
491 }
492 
493 //------------------------------------------------------------------------
494 
495 void Thread::started(void)
496 {
497  m_id = getID();
498  HANDLE process = GetCurrentProcess();
499  if (!DuplicateHandle(process, GetCurrentThread(), process, &m_handle, THREAD_ALL_ACCESS, FALSE, 0))
500  failWin32Error("DuplicateHandle");
501 
502  s_lock.enter();
503 
504  if (!s_mainThread)
505  s_mainThread = this;
506 
507  if (!s_threads.contains(m_id))
508  s_threads.add(m_id, this);
509 
510  s_lock.leave();
511 }
512 
513 //------------------------------------------------------------------------
514 
515 void Thread::exited(void)
516 {
517  if (!m_handle)
518  return;
519 
520  s_lock.enter();
521 
522  if (this == s_mainThread)
523  s_mainThread = NULL;
524 
525  if (s_threads.contains(m_id))
526  s_threads.remove(m_id);
527 
528  if (!s_threads.getSize())
529  s_threads.reset();
530 
531  s_lock.leave();
532 
533  if (m_handle)
534  CloseHandle(m_handle);
535  m_id = 0;
536  m_handle = NULL;
537 }
538 
539 //------------------------------------------------------------------------
540 
541 DWORD WINAPI Thread::threadProc(LPVOID lpParameter)
542 {
543  StartParams* params = (StartParams*)lpParameter;
544  Thread* thread = params->thread;
545  ThreadFunc userFunc = params->userFunc;
546  void* userParam = params->userParam;
547 
548  // Initialize.
549 
550  thread->started();
551  thread->setPriority(thread->m_priority);
552  params->ready.release();
553 
554  // Execute.
555 
556  userFunc(userParam);
557 
558  // Check whether the thread object still exists,
559  // as userFunc() may have deleted it.
560 
561  s_lock.enter();
562  bool exists = s_threads.contains(getID());
563  s_lock.leave();
564 
565  // Still exists => deinit.
566 
567  if (exists)
568  {
569  failIfError();
570  thread->getPriority();
571 
572  thread->refer();
573  thread->m_exited = true;
574  thread->unrefer();
575  }
576  return 0;
577 }
578 
579 //------------------------------------------------------------------------
#define NULL
Definition: Defs.hpp:39
static Thread * getMain(void)
Definition: Thread.cpp:308
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum GLint GLuint mask GLuint GLenum GLuint mask GLsizei GLenum const GLvoid GLuint GLenum GLuint GLenum const GLfloat transformValues GLenum func GLenum GLenum GLint const GLfloat coeffs GLuint GLenum coverMode GLsizei GLenum const GLvoid GLuint GLenum GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLubyte commands GLuint GLfloat dashArray GLbitfield GLuint GLsizei GLsizei GLfloat metrics GLenum GLenum GLint value GLenum GLenum GLint value GLuint GLuint GLfloat GLfloat y GLuint GLsizei GLsizei numSegments HDC const int const FLOAT UINT int UINT nNumFormats HDC int int UINT const int int piValues SleepConditionVariableCS
Definition: DLLImports.inl:448
static U32 getID(void)
Definition: Thread.cpp:324
Semaphore(int initCount=1, int maxCount=1)
Definition: Thread.cpp:68
bool isAlive(void)
Definition: Thread.cpp:370
void setUserData(const String &id, void *data, DeinitFunc deinitFunc=NULL)
Definition: Thread.cpp:418
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid * data
Definition: DLLImports.inl:319
void start(ThreadFunc func, void *param)
Definition: Thread.cpp:271
void setPriority(int priority)
Definition: Thread.cpp:359
~Spinlock(void)
Definition: Thread.cpp:47
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint * params
Definition: DLLImports.inl:373
void failWin32Error(const char *funcName)
Definition: Defs.cpp:345
static void suspendAll(void)
Definition: Thread.cpp:457
int exitCode
Definition: Main.cpp:45
void * getUserData(const String &id)
Definition: Thread.cpp:407
void leave(void)
Definition: Thread.cpp:150
void notify(void)
Definition: Thread.cpp:197
~Thread(void)
Definition: Thread.cpp:245
void release(void)
Definition: Thread.cpp:94
int getPriority(void)
Definition: Thread.cpp:345
void join(void)
Definition: Thread.cpp:393
Monitor(void)
Definition: Thread.cpp:102
Thread(void)
Definition: Thread.cpp:235
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint * param
Definition: DLLImports.inl:341
#define FW_ASSERT(X)
Definition: Defs.hpp:67
bool acquire(int millis=-1)
Definition: Thread.cpp:84
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum func
Definition: DLLImports.inl:400
void notifyAll(void)
Definition: Thread.cpp:216
unsigned int U32
Definition: Defs.hpp:85
Spinlock(void)
Definition: Thread.cpp:40
~Monitor(void)
Definition: Thread.cpp:117
void enter(void)
Definition: Thread.cpp:124
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum GLint GLuint mask GLuint GLenum GLuint mask GLsizei GLenum const GLvoid GLuint GLenum GLuint GLenum const GLfloat transformValues GLenum func GLenum GLenum GLint const GLfloat coeffs GLuint GLenum coverMode GLsizei GLenum const GLvoid GLuint GLenum GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLubyte commands GLuint GLfloat dashArray GLbitfield GLuint GLsizei GLsizei GLfloat metrics GLenum GLenum GLint value GLenum GLenum GLint value GLuint GLuint GLfloat GLfloat y GLuint GLsizei GLsizei numSegments WINAPI
Definition: DLLImports.inl:437
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum GLint GLuint mask GLuint GLenum GLuint mask GLsizei GLenum const GLvoid GLuint GLenum GLuint GLenum const GLfloat transformValues GLenum func GLenum GLenum GLint const GLfloat coeffs GLuint GLenum coverMode GLsizei GLenum const GLvoid GLuint GLenum GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLubyte commands GLuint GLfloat dashArray GLbitfield GLuint GLsizei GLsizei GLfloat metrics GLenum GLenum GLint value GLenum GLenum GLint value GLuint GLuint GLfloat GLfloat y GLuint GLsizei GLsizei numSegments HDC const int const FLOAT UINT int UINT nNumFormats HDC int int UINT const int int piValues PCONDITION_VARIABLE PCRITICAL_SECTION DWORD dwMilliseconds WakeConditionVariable
Definition: DLLImports.inl:450
void failIfError(void)
Definition: Defs.cpp:361
~Semaphore(void)
Definition: Thread.cpp:77
static Thread * getCurrent(void)
Definition: Thread.cpp:291
static void sleep(int millis)
Definition: Thread.cpp:331
void leave(void)
Definition: Thread.cpp:61
static void yield(void)
Definition: Thread.cpp:338
void enter(void)
Definition: Thread.cpp:54
void(* ThreadFunc)(void *param)
Definition: Thread.hpp:112
void wait(void)
Definition: Thread.cpp:167
static bool isMain(void)
Definition: Thread.cpp:316