mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Change distinct -> typedef.
- Order of attribute declaration is changed for `alias`. - Added `LANGUAGE_DEV_VERSION` env constant. - Rename `anyfault` -> `fault`. - Changed `fault` -> `faultdef`. - Added `attrdef` instead of `alias` for attribute aliases.
This commit is contained in:
committed by
Christoffer Lerno
parent
fc5615a7a1
commit
5c77c9a754
@@ -1,6 +1,6 @@
|
||||
module std::thread::channel{Type};
|
||||
|
||||
distinct BufferedChannel = void*;
|
||||
typedef BufferedChannel = void*;
|
||||
|
||||
struct BufferedChannelImpl @private
|
||||
{
|
||||
@@ -48,7 +48,7 @@ fn void? BufferedChannel.destroy(&self)
|
||||
{
|
||||
BufferedChannelImpl* channel = (BufferedChannelImpl*)(*self);
|
||||
|
||||
anyfault err = @catch(channel.mu.destroy());
|
||||
fault err = @catch(channel.mu.destroy());
|
||||
err = @catch(channel.send_cond.destroy()) ?: err;
|
||||
err = @catch(channel.read_cond.destroy()) ?: err;
|
||||
allocator::free(channel.allocator, channel);
|
||||
@@ -147,7 +147,7 @@ fn void? BufferedChannel.close(self)
|
||||
{
|
||||
BufferedChannelImpl* channel = (BufferedChannelImpl*)self;
|
||||
|
||||
anyfault err = @catch(channel.mu.lock());
|
||||
fault err = @catch(channel.mu.lock());
|
||||
|
||||
channel.closed = true;
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ struct EventThreadTask
|
||||
Event*[] events;
|
||||
}
|
||||
|
||||
distinct EventQueue = void;
|
||||
distinct EventHandler = void;
|
||||
distinct EventMultiQueue = void;
|
||||
typedef EventQueue = void;
|
||||
typedef EventHandler = void;
|
||||
typedef EventMultiQueue = void;
|
||||
|
||||
fn EventThreadTask EventQueue.wait_for_task(&self) => EventThreadTask {};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module std::thread;
|
||||
fault THREAD_QUEUE_FULL;
|
||||
faultdef THREAD_QUEUE_FULL;
|
||||
|
||||
module std::thread::threadpool @if (env::POSIX || env::WIN32);
|
||||
import std::thread;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module std::thread::os @if (!env::POSIX && !env::WIN32);
|
||||
|
||||
distinct NativeMutex = int;
|
||||
distinct NativeConditionVariable = int;
|
||||
distinct NativeOnceFlag = int;
|
||||
distinct NativeThread = int;
|
||||
typedef NativeMutex = int;
|
||||
typedef NativeConditionVariable = int;
|
||||
typedef NativeOnceFlag = int;
|
||||
typedef NativeThread = int;
|
||||
@@ -1,7 +1,7 @@
|
||||
module std::thread::os @if(env::WIN32);
|
||||
import std::os::win32, std::time;
|
||||
|
||||
distinct NativeThread = inline Win32_HANDLE;
|
||||
typedef NativeThread = inline Win32_HANDLE;
|
||||
|
||||
struct NativeMutex
|
||||
{
|
||||
|
||||
@@ -2,24 +2,24 @@ module std::thread;
|
||||
import std::thread::os;
|
||||
import std::time;
|
||||
|
||||
distinct MutexType = int;
|
||||
typedef MutexType = int;
|
||||
|
||||
const MutexType MUTEX_PLAIN = 0;
|
||||
const MutexType MUTEX_TIMED = 1;
|
||||
const MutexType MUTEX_RECURSIVE = 2;
|
||||
|
||||
distinct Mutex = NativeMutex;
|
||||
distinct TimedMutex = inline Mutex;
|
||||
distinct RecursiveMutex = inline Mutex;
|
||||
distinct TimedRecursiveMutex = inline Mutex;
|
||||
distinct ConditionVariable = NativeConditionVariable;
|
||||
distinct Thread = inline NativeThread;
|
||||
distinct OnceFlag = NativeOnceFlag;
|
||||
typedef Mutex = NativeMutex;
|
||||
typedef TimedMutex = inline Mutex;
|
||||
typedef RecursiveMutex = inline Mutex;
|
||||
typedef TimedRecursiveMutex = inline Mutex;
|
||||
typedef ConditionVariable = NativeConditionVariable;
|
||||
typedef Thread = inline NativeThread;
|
||||
typedef OnceFlag = NativeOnceFlag;
|
||||
alias OnceFn = fn void();
|
||||
|
||||
alias ThreadFn = fn int(void* arg);
|
||||
|
||||
fault
|
||||
faultdef
|
||||
INIT_FAILED,
|
||||
DESTROY_FAILED,
|
||||
LOCK_FAILED,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module std::thread::channel {Type};
|
||||
|
||||
distinct UnbufferedChannel = void*;
|
||||
typedef UnbufferedChannel = void*;
|
||||
|
||||
struct UnbufferedChannelImpl @private
|
||||
{
|
||||
@@ -44,7 +44,7 @@ fn void? UnbufferedChannel.destroy(&self)
|
||||
{
|
||||
UnbufferedChannelImpl* channel = (UnbufferedChannelImpl*)(*self);
|
||||
|
||||
anyfault err = @catch(channel.mu.destroy());
|
||||
fault err = @catch(channel.mu.destroy());
|
||||
err = @catch(channel.send_mu.destroy()) ?: err;
|
||||
err = @catch(channel.send_cond.destroy()) ?: err;
|
||||
err = @catch(channel.read_mu.destroy()) ?: err;
|
||||
@@ -126,7 +126,7 @@ fn void? UnbufferedChannel.close(self)
|
||||
{
|
||||
UnbufferedChannelImpl* channel = (UnbufferedChannelImpl*)self;
|
||||
|
||||
anyfault err = @catch(channel.mu.lock());
|
||||
fault err = @catch(channel.mu.lock());
|
||||
|
||||
channel.closed = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user