mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 21:23:03 +01:00
Merge pull request #296 from jmglogow/fix-win-thread-handle-type
Fix Thread handle type on Windows
This commit is contained in:
commit
bf3dc9b08c
@ -309,13 +309,16 @@ Thread Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, Han
|
||||
* Advanced Windows by Richter pg. # 109. */
|
||||
|
||||
unsigned thread_id;
|
||||
unsigned long real_handle =
|
||||
_beginthreadex(NULL, 0, THREAD_ENTRYPOINT, THREAD_ARG, CREATE_SUSPENDED, &thread_id);
|
||||
if (!real_handle)
|
||||
HANDLE handle =
|
||||
reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0, THREAD_ENTRYPOINT, THREAD_ARG, CREATE_SUSPENDED, &thread_id));
|
||||
if (!handle)
|
||||
{
|
||||
// Though MSDN says that _beginthreadex() returns error in errno,
|
||||
// GetLastError() still works because RTL call no other system
|
||||
// functions after CreateThread() in the case of error.
|
||||
// Watch out if it is ever changed.
|
||||
Firebird::system_call_failed::raise("_beginthreadex", GetLastError());
|
||||
}
|
||||
HANDLE handle = reinterpret_cast<HANDLE>(real_handle);
|
||||
|
||||
SetThreadPriority(handle, priority);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user