mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Support "typedef"
This commit is contained in:
committed by
Christoffer Lerno
parent
b7e19b75d0
commit
df77b692d6
@@ -1,6 +1,6 @@
|
||||
module std::thread;
|
||||
|
||||
define NativeMutex = distinct int;
|
||||
define NativeConditionVariable = distinct int;
|
||||
define NativeOnceFlag = distinct int;
|
||||
define NativeThread = distinct int;
|
||||
typedef NativeMutex = distinct int;
|
||||
typedef NativeConditionVariable = distinct int;
|
||||
typedef NativeOnceFlag = distinct int;
|
||||
typedef NativeThread = distinct int;
|
||||
@@ -7,30 +7,30 @@ const PTHREAD_MUTEX_NORMAL = 0;
|
||||
const PTHREAD_MUTEX_ERRORCHECK = 1;
|
||||
const PTHREAD_MUTEX_RECURSIVE = 2;
|
||||
|
||||
define NativeMutex = PthreadMutex;
|
||||
define NativeConditionVariable = PthreadCond;
|
||||
define NativeThread = Pthread;
|
||||
define NativeOnceFlag = PthreadOnce;
|
||||
typedef NativeMutex = PthreadMutex;
|
||||
typedef NativeConditionVariable = PthreadCond;
|
||||
typedef NativeThread = Pthread;
|
||||
typedef NativeOnceFlag = PthreadOnce;
|
||||
|
||||
define Pthread = distinct void*;
|
||||
typedef Pthread = distinct void*;
|
||||
|
||||
$if (env::OS_TYPE == OsType.LINUX):
|
||||
define PthreadMutex = distinct ulong[5];
|
||||
define PthreadAttribute = distinct ulong[7];
|
||||
define PthreadMutexAttribute = distinct uint;
|
||||
define PthreadCondAttribute = distinct uint;
|
||||
define PthreadCond = distinct ulong[6];
|
||||
define PthreadOnce = distinct uint;
|
||||
typedef PthreadMutex = distinct ulong[5];
|
||||
typedef PthreadAttribute = distinct ulong[7];
|
||||
typedef PthreadMutexAttribute = distinct uint;
|
||||
typedef PthreadCondAttribute = distinct uint;
|
||||
typedef PthreadCond = distinct ulong[6];
|
||||
typedef PthreadOnce = distinct uint;
|
||||
$else:
|
||||
define PthreadMutex = distinct ulong[8];
|
||||
define PthreadMutexAttribute = distinct ulong[2];
|
||||
define PthreadAttribute = distinct ulong[8];
|
||||
define PthreadCond = distinct ulong[6];
|
||||
define PthreadCondAttribute = distinct ulong[8];
|
||||
define PthreadOnce = distinct ulong[2];
|
||||
typedef PthreadMutex = distinct ulong[8];
|
||||
typedef PthreadMutexAttribute = distinct ulong[2];
|
||||
typedef PthreadAttribute = distinct ulong[8];
|
||||
typedef PthreadCond = distinct ulong[6];
|
||||
typedef PthreadCondAttribute = distinct ulong[8];
|
||||
typedef PthreadOnce = distinct ulong[2];
|
||||
$endif;
|
||||
|
||||
define PosixThreadFn = fn void*(void*);
|
||||
typedef PosixThreadFn = fn void*(void*);
|
||||
|
||||
extern fn int pthread_attr_destroy(PthreadAttribute*);
|
||||
extern fn int pthread_attr_getdetachstate(PthreadAttribute*, int*);
|
||||
|
||||
@@ -2,9 +2,9 @@ module std::thread::os;
|
||||
|
||||
$if (thread::THREAD_MODEL == ThreadModel.WIN32):
|
||||
|
||||
define NativeThread = Win32_HANDLE;
|
||||
define Win32_CRITICAL_SECTION = distinct ulong[5];
|
||||
define Win32_HANDLE = distinct ulong;
|
||||
typedef NativeThread = Win32_HANDLE;
|
||||
typedef Win32_CRITICAL_SECTION = distinct ulong[5];
|
||||
typedef Win32_HANDLE = distinct ulong;
|
||||
|
||||
struct NativeMutex
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user