mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 04:43:03 +01:00
Restore separate datatypes for thread ID and handle according to Vlad's request. They match on posix build, but supposed to be different on windows.
This commit is contained in:
parent
4041b0e780
commit
bb034da477
@ -93,7 +93,7 @@ THREAD_ENTRY_DECLARE threadStart(THREAD_ENTRY_PARAM arg)
|
||||
|
||||
#ifdef USE_POSIX_THREADS
|
||||
#define START_THREAD
|
||||
void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, ThreadId* thd_id)
|
||||
void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, Handle* thd_id)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -173,14 +173,14 @@ void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, Threa
|
||||
}
|
||||
}
|
||||
|
||||
void Thread::waitForCompletion(ThreadId& thread)
|
||||
void Thread::waitForCompletion(Handle& thread)
|
||||
{
|
||||
int state = pthread_join(thread, NULL);
|
||||
if (state)
|
||||
Firebird::system_call_failed::raise("pthread_join", state);
|
||||
}
|
||||
|
||||
void Thread::kill(ThreadId& thread)
|
||||
void Thread::kill(Handle& thread)
|
||||
{
|
||||
int state = pthread_cancel(thread);
|
||||
if (state)
|
||||
@ -192,7 +192,7 @@ void Thread::kill(ThreadId& thread)
|
||||
|
||||
#ifdef WIN_NT
|
||||
#define START_THREAD
|
||||
void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, ThreadId* thd_id)
|
||||
void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, Handle* thd_id)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -258,14 +258,14 @@ void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, Threa
|
||||
}
|
||||
}
|
||||
|
||||
void Thread::waitForCompletion(ThreadId& handle)
|
||||
void Thread::waitForCompletion(Handle& handle)
|
||||
{
|
||||
WaitForSingleObject(handle, INFINITE);
|
||||
CloseHandle(handle);
|
||||
handle = 0;
|
||||
}
|
||||
|
||||
void Thread::kill(ThreadId& handle)
|
||||
void Thread::kill(Handle& handle)
|
||||
{
|
||||
TerminateThread(handle, -1);
|
||||
CloseHandle(handle);
|
||||
@ -276,7 +276,7 @@ void Thread::kill(ThreadId& handle)
|
||||
|
||||
|
||||
#ifndef START_THREAD
|
||||
void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, ThreadId* thd_id)
|
||||
void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, Handle* thd_id)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -291,11 +291,11 @@ void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, Threa
|
||||
|
||||
}
|
||||
|
||||
void Thread::waitForCompletion(ThreadId&)
|
||||
void Thread::waitForCompletion(Handle&)
|
||||
{
|
||||
}
|
||||
|
||||
void Thread::kill(ThreadId&)
|
||||
void Thread::kill(Handle&)
|
||||
{
|
||||
}
|
||||
#endif // START_THREAD
|
||||
|
@ -30,7 +30,6 @@
|
||||
#ifndef JRD_THREADSTART_H
|
||||
#define JRD_THREADSTART_H
|
||||
|
||||
#include "firebird.h"
|
||||
#include "../common/thd.h"
|
||||
#include "../common/ThreadData.h"
|
||||
|
||||
@ -54,9 +53,17 @@ typedef THREAD_ENTRY_DECLARE ThreadEntryPoint(THREAD_ENTRY_PARAM);
|
||||
class Thread
|
||||
{
|
||||
public:
|
||||
static void start(ThreadEntryPoint* routine, void* arg, int priority_arg, ThreadId* thd_id = NULL);
|
||||
static void waitForCompletion(ThreadId& handle);
|
||||
static void kill(ThreadId& handle);
|
||||
#ifdef WIN_NT
|
||||
typedef HANDLE Handle;
|
||||
#endif
|
||||
|
||||
#ifdef USE_POSIX_THREADS
|
||||
typedef pthread_t Handle;
|
||||
#endif
|
||||
|
||||
static void start(ThreadEntryPoint* routine, void* arg, int priority_arg, Handle* p_handle = NULL);
|
||||
static void waitForCompletion(Handle& handle);
|
||||
static void kill(Handle& handle);
|
||||
};
|
||||
|
||||
#endif // JRD_THREADSTART_H
|
||||
|
Loading…
Reference in New Issue
Block a user