![]() |
VR-Link API Documentation for HLA Evolved
|
00001 /******************************************************************************* 00002 ** Copyright (c) 1992-2010 VT MAK 00003 ** All rights reserved. 00004 *******************************************************************************/ 00008 #pragma once 00009 00010 #ifdef DtUSE_UTILITIES_NAMESPACE 00011 namespace DtUSE_UTILITIES_NAMESPACE 00012 { 00013 #endif 00014 00016 typedef void* (*DtThreadFunc)(void*); 00017 00018 enum DtThreadStatus 00019 { 00020 DtThreadSuccess, 00021 DtThreadError, 00022 DtThreadExitFailed 00023 }; 00024 00025 #ifdef DtUSE_UTILITIES_NAMESPACE 00026 } 00027 #endif 00028 00029 #ifdef _WIN32 00030 00031 /**************************************************** 00032 WINDOWS WINDOWS WINDOWS WINDOWS 00033 ****************************************************/ 00034 00037 #include <winsock2.h> 00038 #include <ws2tcpip.h> 00039 00041 #include <windows.h> 00042 00043 #ifdef DtUSE_UTILITIES_NAMESPACE 00044 namespace DtUSE_UTILITIES_NAMESPACE 00045 { 00046 #endif 00047 00048 typedef HANDLE DtThreadHandle; 00049 00052 typedef DWORD DtThreadId; 00053 00054 #ifdef DtUSE_UTILITIES_NAMESPACE 00055 } 00056 #endif 00057 00058 #else 00059 00060 /**************************************************** 00061 POSIX POSIX POSIX POSIX 00062 ****************************************************/ 00063 00064 #include <pthread.h> 00065 #include <unistd.h> 00066 #include <sched.h> 00067 #include <errno.h> 00068 00069 00070 #ifdef DtUSE_UTILITIES_NAMESPACE 00071 namespace DtUSE_UTILITIES_NAMESPACE 00072 { 00073 #endif 00074 00075 typedef pthread_t DtThreadId; 00078 typedef DtThreadId DtThreadHandle; 00079 00080 #ifdef DtUSE_UTILITIES_NAMESPACE 00081 } 00082 #endif 00083 00084 #endif 00085 00086 00087 /**************************************************** 00089 ****************************************************/ 00090 00091 #ifdef DtUSE_UTILITIES_NAMESPACE 00092 namespace DtUSE_UTILITIES_NAMESPACE 00093 { 00094 #endif 00095 00096 00107 DtThreadHandle DtThreadCreate(DtThreadFunc runFunction, void* param, DtThreadId* threadId); 00108 00109 00116 void DtThreadExit(void* exitCode); 00117 00124 DtThreadId DtGetThreadId(); 00125 00132 DtThreadStatus DtThreadJoin(DtThreadHandle threadHandle); 00133 00144 DtThreadStatus DtThreadStop(DtThreadHandle threadHandle); 00145 00153 void DtThreadCleanUp(DtThreadHandle threadHandle); 00154 00155 00156 #ifdef DtUSE_UTILITIES_NAMESPACE 00157 } 00158 #endif 00159 00160 00161 00162 00163 00164