source: libcf/trunk/include/cf_thread.h@ 4

Last change on this file since 4 was 4, checked in by cheese, 11 years ago

#1 로깅을 제외한 기본 코드 커밋

File size: 1.2 KB
Line 
1/**
2 * cf_thread.h
3 */
4#ifndef __CF_THREAD_H__
5#define __CF_THREAD_H__
6
7#include "cf_base.h"
8
9#ifdef _WIN32
10//# include <stddef.h>
11# define CF_THREAD_RETURN uintptr_t
12# define CF_THREAD_CALL __stdcall
13#else // #ifdef _WIN32
14# define CF_THREAD_RETURN void *
15# define CF_THREAD_CALL
16#endif // #ifdef _WIN32
17
18#define CF_THREAD_FUNCTION CF_THREAD_RETURN CF_THREAD_CALL
19
20#define CF_ERROR_THREAD CF_ERROR_BASE * 4
21#define CF_ERROR_THREAD_CREATE CF_ERROR_THREAD - 1
22#define CF_ERROR_THREAD_INVALID_ARGS CF_ERROR_THREAD - 2
23
24#define CF_ERROR_MUTEX CF_ERROR_BASE * 5
25#define CF_ERROR_MUTEX_CREATE CF_ERROR_MUTEX - 1
26#define CF_ERROR_MUTEX_INVALID_ARGS CF_ERROR_MUTEX - 2
27
28typedef void * CF_Thread;
29typedef void * CF_Mutex;
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35CF_EXPORT int
36CF_Thread_Create (CF_Thread * threadID,
37 CF_THREAD_RETURN callback,
38 void * arg);
39
40CF_EXPORT int
41CF_Thread_Release (CF_Thread * threadID);
42
43CF_EXPORT int
44CF_Thread_Join (CF_Thread * threadID);
45
46CF_EXPORT int
47CF_Mutex_Create (CF_Mutex * mutex);
48
49CF_EXPORT int
50CF_Mutex_Destory (CF_Mutex * mutex);
51
52CF_EXPORT int
53CF_Mutex_Lock (CF_Mutex * mutex);
54
55CF_EXPORT int
56CF_Mutex_Unlock (CF_Mutex * mutex);
57
58#ifdef __cplusplus
59}
60#endif
61
62#endif // #ifndef __CF_THREAD_H__
Note: See TracBrowser for help on using the repository browser.