Go to the documentation of this file.
36 #ifndef _U_Thread_Win32_
37 #define _U_Thread_Win32_
39 #include "rtabmap/utilite/utilite_export.h"
51 # ifdef _USE_BEGINTHREAD
52 # define THREAD_CALL __cdecl
53 # define THREAD_HANDLE uintptr_t
54 # define THREAD_RET_T void
55 # define CREATE_THREAD_FAILED (-1L)
56 # define CREATE_THREAD_ERROR (errno)
57 # define CREATE_THREAD(_S,_F,_P) ((Handle)_beginthread((void (__cdecl *)(void *))_F,_S,(void *)_P))
58 # define EXIT_THREAD _endthread()
59 # define CLOSE_HANDLE(x) 1
60 # define THREAD_RETURN(x) return
62 # define THREAD_CALL WINAPI
63 # define THREAD_HANDLE HANDLE
64 # define THREAD_RET_T UINT
65 # define CREATE_THREAD_FAILED (0L)
66 # define CREATE_THREAD_ERROR (errno)
67 # define CREATE_THREAD(_S,_F,_P) ((Handle)_beginthreadex(0,_S,(UINT (WINAPI *)(void *))_F,(void *)_P,0,0))
68 # define EXIT_THREAD _endthreadex(0)
69 # define CLOSE_HANDLE(x) CloseHandle(x)
70 # define THREAD_RETURN(x) return(x)
73 # define THREAD_CALL WINAPI
74 # define THREAD_HANDLE HANDLE
75 # define THREAD_RET_T DWORD
76 # define CREATE_THREAD_FAILED (0L)
77 # define CREATE_THREAD_ERROR GetLastError()
78 # define CREATE_THREAD(_S,_F,_P) ((Handle)CreateThread(0,_S,(DWORD (WINAPI *)(void *))_F,(void *)_P,0,0))
79 # define CREATE_THREAD2(_S,_F,_P,_ID) ((Handle)CreateThread(0,_S,(DWORD (WINAPI *)(void *))_F,(void *)_P,0,_ID))
80 # define EXIT_THREAD ExitThread(0)
81 # define CLOSE_HANDLE(x) CloseHandle(x)
82 # define THREAD_RETURN(x) return(x)
85 #define InvalidHandle 0
98 typedef const Thread_T & Thread_C_R;
106 virtual void ThreadMain( Thread_R ) = 0;
117 DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),(LPHANDLE)&Hnd,
NULL,0,
NULL);
127 const Handler & Function,
130 const bool & CreateDetached =
false,
131 const unsigned int & StackSize = 0,
132 const bool & CancelEnable =
false,
133 const bool & CancelAsync =
false
161 const bool & CreateDetached =
false,
162 const unsigned int & StackSize = 0,
163 const bool & CancelEnable =
false,
164 const bool & CancelAsync =
false
191 DWORD
R = WaitForSingleObject((HANDLE)
H,INFINITE);
193 if ( (
R == WAIT_OBJECT_0) || (
R == WAIT_ABANDONED) )
199 if (
R == WAIT_TIMEOUT )
return EAGAIN;
204 {
return TerminateThread((HANDLE)
H,0) ? 0 : EINVAL; }
217 Thread_T Data(
I.Data);
221 I.Owner->ThreadMain(Data);
232 : pFN(pH), Data(
P), Owner(
O) {}
252 typedef void ( *Handler)();
259 virtual void ThreadMain() = 0;
269 return (
int)GetCurrentThreadId();
281 const Handler & Function,
283 const bool & CreateDetached =
false,
284 const unsigned int & StackSize = 0,
285 const bool & CancelEnable =
false,
286 const bool & CancelAsync =
false
304 const bool & CreateDetached =
false,
305 const unsigned int & StackSize = 0,
306 const bool & CancelEnable =
false,
307 const bool & CancelAsync =
false
325 unsigned long & ThreadId,
327 const bool & CreateDetached =
false,
328 const unsigned int & StackSize = 0,
329 const bool & CancelEnable =
false,
330 const bool & CancelAsync =
false
336 ThreadId = (
unsigned long)
id;
350 DWORD
R = WaitForSingleObject((HANDLE)
H,INFINITE);
352 if ( (
R == WAIT_OBJECT_0) || (
R == WAIT_ABANDONED) )
358 if (
R == WAIT_TIMEOUT )
return EAGAIN;
363 {
return TerminateThread((HANDLE)
H,0) ? 0 : EINVAL; }
385 #endif // !_U_Thread_Win32_
#define CREATE_THREAD_FAILED
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[ *:*] noreverse nowriteback set trange[ *:*] noreverse nowriteback set urange[ *:*] noreverse nowriteback set vrange[ *:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
UThreadC< Thread_T >::Handler pFN
static int Join(const Handle &H)
static const UMutex & M_Create()
Instance(Thread_C_R P, UThreadC< Thread_T > *const &O, const typename UThreadC< Thread_T >::Handler &pH=0)
#define CREATE_THREAD_ERROR
static int Detach(const Handle &H)
static int Create(const Handler &Function, Thread_C_R Param, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false)
#define CREATE_THREAD(_S, _F, _P)
#define CREATE_THREAD2(_S, _F, _P, _ID)
static int Join(const Handle &H)
void uSleep(unsigned int ms)
int Create(Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const
int Create(unsigned long &ThreadId, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const
static int Kill(const Handle &H)
static int Kill(const Handle &H)
UThreadC< Thread_T >::Thread_C_R Data
static int Create(const Handler &Function, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false)
static THREAD_RET_T THREAD_CALL ThreadMainHandler_S(Handler Param)
static THREAD_RET_T THREAD_CALL ThreadMainHandler(UThreadC< void > *Param)
int Create(Thread_C_R Param, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const
virtual void ThreadMain()=0
static const USemaphore & S_Create()
static int Detach(const Handle &H)
static THREAD_RET_T THREAD_CALL ThreadMainHandler(Instance *Param)
rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:23