| #pragma once |
| |
| #ifndef igs_resource_thread_h |
| #define igs_resource_thread_h |
| |
| #if defined _WIN32 //------------------------------------------------- |
| #include <windows.h> // HANDLE |
| #include <process.h> // _beginthreadex() |
| #ifndef IGS_RESOURCE_IFX_EXPORT |
| #define IGS_RESOURCE_IFX_EXPORT |
| #endif |
| namespace igs { |
| namespace resource { |
| |
| IGS_RESOURCE_IFX_EXPORT const HANDLE thread_run( |
| unsigned(__stdcall *function)(void *), void *func_arg, |
| const int priority = THREAD_PRIORITY_NORMAL |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| ); |
| IGS_RESOURCE_IFX_EXPORT const bool thread_was_done(const HANDLE thread_id); |
| IGS_RESOURCE_IFX_EXPORT void thread_join(const HANDLE thread_id); |
| IGS_RESOURCE_IFX_EXPORT void thread_wait(const HANDLE thread_id); |
| IGS_RESOURCE_IFX_EXPORT void thread_close(const HANDLE thread_id); |
| } |
| } |
| #else //-------------------------------------------------------------- |
| #include <pthread.h> // pthread_t,pthread_create(),pthread_join() |
| namespace igs { |
| namespace resource { |
| |
| pthread_t thread_run( |
| void *(*function)(void *), void *func_arg, |
| const int state = PTHREAD_CREATE_JOINABLE |
| |
| |
| |
| |
| |
| |
| ); |
| void thread_join(const pthread_t thread_id); |
| } |
| } |
| #endif //------------------------------------------------------------- |
| |
| #endif /* !igs_resource_thread_h */ |