mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
* add join for ThreadPool without destroying the threads * Make the main Thread block waiting for the worker threads to finish instead of buzy looping and do proper initialization and freeing of all variables. * Updated test to use `atomic_store` and take into account the maximum queue size of the threadpool. * - Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads. - Return of Thread/Mutex/CondVar `destroy()` is now "@maydiscard" and should be ignored. It will return void in 0.8.0. - Return of Mutex `unlock()` and `lock()` is now "@maydiscard" and should be ignored. They will return void in 0.8.0. - Return of ConditionVariable `signal()` `broadcast()` and `wait()` are now "@maydiscard". They will return void in 0.8.0. - Return of Thread `detatch()` is now "@maydiscard". It will return void in 0.8.0. - Buffered/UnbufferedChannel, and both ThreadPools have `@maydiscard` on a set of functions. They will retunr void in 0.8.0. - Pthread bindings correctly return Errno instead of CInt. - Return of Thread `join()` is now "@maydiscard". --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
27 lines
633 B
Plaintext
27 lines
633 B
Plaintext
module std::thread::os @if (!env::POSIX && !env::WIN32);
|
|
|
|
typedef NativeMutex = int;
|
|
typedef NativeTimedMutex = int;
|
|
typedef NativeConditionVariable = int;
|
|
typedef NativeOnceFlag = int;
|
|
typedef NativeThread = int;
|
|
|
|
fn void NativeOnceFlag.call_once(&flag, OnceFn func)
|
|
{
|
|
if (*flag == 0)
|
|
{
|
|
*flag = 1;
|
|
func();
|
|
}
|
|
}
|
|
|
|
fn void? NativeMutex.init(&mtx, MutexType type) => NOT_IMPLEMENTED?;
|
|
|
|
fn bool NativeMutex.is_initialized(&self)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
macro void NativeMutex.lock(&mutex) => NOT_IMPLEMENTED?!!;
|
|
macro bool NativeMutex.try_lock(&mutex) => NOT_IMPLEMENTED?!!;
|
|
macro void NativeMutex.unlock(&mutex) => NOT_IMPLEMENTED?!!; |