cwThread.h/cpp : thread_id_t is changed form unsigned to unsigned long long.
This commit is contained in:
parent
46b42b34ef
commit
8fbd2fee2d
17
cwThread.cpp
17
cwThread.cpp
@ -204,8 +204,21 @@ cw::thread::stateId_t cw::thread::state( handle_t h )
|
||||
return p->stateId;
|
||||
}
|
||||
|
||||
unsigned cw::thread::id()
|
||||
{ return static_cast<unsigned>(pthread_self()); }
|
||||
cw::thread::thread_id_t cw::thread::id()
|
||||
{
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
thread_id_t id;
|
||||
pthread_t pthread_id;
|
||||
} u;
|
||||
} id_t;
|
||||
|
||||
id_t id;
|
||||
id.u.pthread_id = pthread_self();
|
||||
return id.u.id;
|
||||
}
|
||||
|
||||
namespace cw
|
||||
{
|
||||
|
@ -17,6 +17,8 @@ namespace cw
|
||||
|
||||
typedef bool (*cbFunc_t)( void* arg );
|
||||
|
||||
typedef unsigned long long thread_id_t;
|
||||
|
||||
// stateMicros = total time out duration for switching to the exit state or for switching in/out of pause state.
|
||||
// pauseMicros = duration of thread sleep interval when in paused state.
|
||||
rc_t create( handle_t& hRef, cbFunc_t func, void* funcArg, int stateTimeOutMicros=100000, int pauseMicros=10000 );
|
||||
@ -30,7 +32,7 @@ namespace cw
|
||||
stateId_t state( handle_t h );
|
||||
|
||||
// Return the thread id of the calling context.
|
||||
unsigned id();
|
||||
thread_id_t id();
|
||||
}
|
||||
rc_t threadTest();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user