mirror of
https://github.com/odin-lang/Odin.git
synced 2026-10-12 02:40:41 -04:00
Fix cond_wait synchronizing on the condition variable; match objects within each other; mark more Win32 waits
This commit is contained in:
1 parent
8bf769b039
commit
80f640c18d
4 files changed
+16
-5
No files matched your search
@@ -443,7 +443,6 @@ The mutex must be held by the calling thread, before calling the procedure.
|
||||
**Note**: This procedure can return on a spurious wake-up, even if the condition
|
||||
variable was not signalled by a thread.
|
||||
*/
|
||||
@(synchronizes=.Acquire)
|
||||
cond_wait :: proc "contextless" (c: ^Cond, m: ^Mutex) {
|
||||
_cond_wait(c, m)
|
||||
}
|
||||
@@ -462,7 +461,6 @@ If the timeout was reached, this procedure returns `false`. Otherwise it returns
|
||||
|
||||
Before this procedure is called the mutex must be held by the calling thread.
|
||||
*/
|
||||
@(synchronizes=.Acquire)
|
||||
cond_wait_with_timeout :: proc "contextless" (c: ^Cond, m: ^Mutex, duration: time.Duration) -> bool {
|
||||
if duration <= 0 {
|
||||
return false
|
||||
|
||||
@@ -325,7 +325,6 @@ Atomic_Cond :: struct {
|
||||
state: Futex,
|
||||
}
|
||||
|
||||
@(synchronizes=.Acquire)
|
||||
atomic_cond_wait :: proc "contextless" (c: ^Atomic_Cond, m: ^Atomic_Mutex) {
|
||||
state := u32(atomic_load_explicit(&c.state, .Relaxed))
|
||||
unlock(m)
|
||||
@@ -334,7 +333,6 @@ atomic_cond_wait :: proc "contextless" (c: ^Atomic_Cond, m: ^Atomic_Mutex) {
|
||||
|
||||
}
|
||||
|
||||
@(synchronizes=.Acquire)
|
||||
atomic_cond_wait_with_timeout :: proc "contextless" (c: ^Atomic_Cond, m: ^Atomic_Mutex, duration: time.Duration) -> (ok: bool) {
|
||||
state := u32(atomic_load_explicit(&c.state, .Relaxed))
|
||||
unlock(m)
|
||||
|
||||
@@ -181,6 +181,7 @@ foreign kernel32 {
|
||||
lpThreadId: LPDWORD,
|
||||
) -> HANDLE ---
|
||||
SwitchToThread :: proc() -> BOOL ---
|
||||
@(synchronizes=.Release)
|
||||
ResumeThread :: proc(thread: HANDLE) -> DWORD ---
|
||||
GetThreadPriority :: proc(thread: HANDLE) -> c_int ---
|
||||
SetThreadPriority :: proc(thread: HANDLE, priority: c_int) -> BOOL ---
|
||||
@@ -230,7 +231,9 @@ foreign kernel32 {
|
||||
) -> BOOL ---
|
||||
@(synchronizes=.Acquire)
|
||||
WaitForSingleObject :: proc(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD ---
|
||||
@(synchronizes=.Acquire)
|
||||
WaitForSingleObjectEx :: proc(hHandle: HANDLE, dwMilliseconds: DWORD, bAlterable: BOOL) -> DWORD ---
|
||||
@(synchronizes=.Acq_Rel)
|
||||
EnterSynchronizationBarrier :: proc(
|
||||
lpBarrier: ^SYNCHRONIZATION_BARRIER,
|
||||
dwFlags: SYNCHRONIZATION_BARRIER_FLAGS,
|
||||
@@ -433,6 +436,7 @@ foreign kernel32 {
|
||||
bWaitAll: BOOL,
|
||||
dwMilliseconds: DWORD,
|
||||
) -> DWORD ---
|
||||
@(synchronizes=.Acquire)
|
||||
WaitForMultipleObjectsEx :: proc(
|
||||
nCount: DWORD,
|
||||
lpHandles: ^HANDLE,
|
||||
|
||||
+12
-1
@@ -376,7 +376,18 @@ gb_internal AtomicObject check_atomic_object(Ast *expr) {
|
||||
}
|
||||
|
||||
gb_internal bool check_atomic_same_object(AtomicObject const &a, AtomicObject const &b) {
|
||||
return a.root != nullptr && a.root == b.root && a.path == b.path;
|
||||
if (a.root == nullptr || a.root != b.root) {
|
||||
return false;
|
||||
}
|
||||
String outer = a.path;
|
||||
String inner = b.path;
|
||||
if (outer.len > inner.len) {
|
||||
gb_swap(String, outer, inner);
|
||||
}
|
||||
if (!string_starts_with(inner, outer)) {
|
||||
return false;
|
||||
}
|
||||
return inner.len == outer.len || inner[outer.len] == '.' || inner[outer.len] == '[';
|
||||
}
|
||||
|
||||
gb_internal Ast *check_atomic_call_address(Ast *call) {
|
||||
|
||||
Reference in new issue
Block a user