📄 thread.h
字号:
#ifndef THREAD_H#define THREAD_H#if defined(__UNIX__)# define PTHREADS#elif defined(__WIN32__)# define WINTHREADS#endif#if defined(PTHREADS)# include <pthread.h>typedef pthread_t thr_t;typedef pthread_mutex_t thr_mutex_t;typedef void * thr_exitcode_t;typedef void *(*thr_startfunc_ptr_t)(void *);typedef void * thr_startfunc_t;#elif defined(WINTHREADS)# include <windows.h>typedef HANDLE thr_t;typedef HANDLE thr_mutex_t;typedef DWORD thr_exitcode_t;typedef LPTHREAD_START_ROUTINE thr_startfunc_ptr_t;#define thr_startfunc_t thr_exitcode_t WINAPI#endifint thr_create(thr_t *thread, int detached, thr_startfunc_ptr_t startfunc, void *arg);int thr_cancel(thr_t thread);void thr_exit(thr_exitcode_t retval);thr_t thr_self(void);int thr_equal(thr_t thread1, thr_t thread2);int thr_join(thr_t thread, thr_exitcode_t *retval);int thr_detach(thr_t thread);thr_mutex_t thr_mutex_create(void);int thr_mutex_destroy(thr_mutex_t *mutex);int thr_mutex_lock(thr_mutex_t *mutex);int thr_mutex_trylock(thr_mutex_t *mutex);int thr_mutex_unlock(thr_mutex_t *mutex);#endif /* THREAD_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -