mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Change to use ODIN_VALGRIND_SUPPORT
This commit is contained in:
@@ -110,7 +110,7 @@ Barrier :: struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
barrier_init :: proc "contextless" (b: ^Barrier, thread_count: int) {
|
barrier_init :: proc "contextless" (b: ^Barrier, thread_count: int) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_barrier_resize_pre(b, uint(thread_count))
|
vg.helgrind_barrier_resize_pre(b, uint(thread_count))
|
||||||
}
|
}
|
||||||
b.index = 0
|
b.index = 0
|
||||||
@@ -121,7 +121,7 @@ barrier_init :: proc "contextless" (b: ^Barrier, thread_count: int) {
|
|||||||
// Block the current thread until all threads have rendezvoused
|
// Block the current thread until all threads have rendezvoused
|
||||||
// Barrier can be reused after all threads rendezvoused once, and can be used continuously
|
// Barrier can be reused after all threads rendezvoused once, and can be used continuously
|
||||||
barrier_wait :: proc "contextless" (b: ^Barrier) -> (is_leader: bool) {
|
barrier_wait :: proc "contextless" (b: ^Barrier) -> (is_leader: bool) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_barrier_wait_pre(b)
|
vg.helgrind_barrier_wait_pre(b)
|
||||||
}
|
}
|
||||||
guard(&b.mutex)
|
guard(&b.mutex)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ _Sema :: struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_sema_post :: proc "contextless" (s: ^Sema, count := 1) {
|
_sema_post :: proc "contextless" (s: ^Sema, count := 1) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_sem_post_pre(s)
|
vg.helgrind_sem_post_pre(s)
|
||||||
}
|
}
|
||||||
atomic_sema_post(&s.impl.atomic, count)
|
atomic_sema_post(&s.impl.atomic, count)
|
||||||
@@ -18,13 +18,13 @@ _sema_post :: proc "contextless" (s: ^Sema, count := 1) {
|
|||||||
|
|
||||||
_sema_wait :: proc "contextless" (s: ^Sema) {
|
_sema_wait :: proc "contextless" (s: ^Sema) {
|
||||||
atomic_sema_wait(&s.impl.atomic)
|
atomic_sema_wait(&s.impl.atomic)
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_sem_wait_post(s)
|
vg.helgrind_sem_wait_post(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_sema_wait_with_timeout :: proc "contextless" (s: ^Sema, duration: time.Duration) -> bool {
|
_sema_wait_with_timeout :: proc "contextless" (s: ^Sema, duration: time.Duration) -> bool {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
defer vg.helgrind_sem_wait_post(s)
|
defer vg.helgrind_sem_wait_post(s)
|
||||||
}
|
}
|
||||||
return atomic_sema_wait_with_timeout(&s.impl.atomic, duration)
|
return atomic_sema_wait_with_timeout(&s.impl.atomic, duration)
|
||||||
@@ -37,7 +37,7 @@ _Recursive_Mutex :: struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_recursive_mutex_lock :: proc "contextless" (m: ^Recursive_Mutex) {
|
_recursive_mutex_lock :: proc "contextless" (m: ^Recursive_Mutex) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_mutex_lock_pre(m, false)
|
vg.helgrind_mutex_lock_pre(m, false)
|
||||||
defer vg.helgrind_mutex_lock_post(m)
|
defer vg.helgrind_mutex_lock_post(m)
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ _recursive_mutex_lock :: proc "contextless" (m: ^Recursive_Mutex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_recursive_mutex_unlock :: proc "contextless" (m: ^Recursive_Mutex) {
|
_recursive_mutex_unlock :: proc "contextless" (m: ^Recursive_Mutex) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_mutex_unlock_pre(m)
|
vg.helgrind_mutex_unlock_pre(m)
|
||||||
defer vg.helgrind_mutex_unlock_post(m)
|
defer vg.helgrind_mutex_unlock_post(m)
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ when ODIN_OS != .Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mutex_lock :: proc "contextless" (m: ^Mutex) {
|
_mutex_lock :: proc "contextless" (m: ^Mutex) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_mutex_lock_pre(m, false)
|
vg.helgrind_mutex_lock_pre(m, false)
|
||||||
defer vg.helgrind_mutex_lock_post(m)
|
defer vg.helgrind_mutex_lock_post(m)
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ when ODIN_OS != .Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mutex_unlock :: proc "contextless" (m: ^Mutex) {
|
_mutex_unlock :: proc "contextless" (m: ^Mutex) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_mutex_unlock_pre(m)
|
vg.helgrind_mutex_unlock_pre(m)
|
||||||
defer vg.helgrind_mutex_unlock_post(m)
|
defer vg.helgrind_mutex_unlock_post(m)
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ when ODIN_OS != .Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mutex_try_lock :: proc "contextless" (m: ^Mutex) -> bool {
|
_mutex_try_lock :: proc "contextless" (m: ^Mutex) -> bool {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_mutex_lock_pre(m, true)
|
vg.helgrind_mutex_lock_pre(m, true)
|
||||||
defer vg.helgrind_mutex_lock_post(m)
|
defer vg.helgrind_mutex_lock_post(m)
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ when ODIN_OS != .Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_cond_wait :: proc "contextless" (c: ^Cond, m: ^Mutex) {
|
_cond_wait :: proc "contextless" (c: ^Cond, m: ^Mutex) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
_ = vg.helgrind_cond_wait_pre(c, m)
|
_ = vg.helgrind_cond_wait_pre(c, m)
|
||||||
defer _ = vg.helgrind_cond_wait_post(c, m)
|
defer _ = vg.helgrind_cond_wait_post(c, m)
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ when ODIN_OS != .Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_cond_wait_with_timeout :: proc "contextless" (c: ^Cond, m: ^Mutex, duration: time.Duration) -> bool {
|
_cond_wait_with_timeout :: proc "contextless" (c: ^Cond, m: ^Mutex, duration: time.Duration) -> bool {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
_ = vg.helgrind_cond_wait_pre(c, m)
|
_ = vg.helgrind_cond_wait_pre(c, m)
|
||||||
defer _ = vg.helgrind_cond_wait_post(c, m)
|
defer _ = vg.helgrind_cond_wait_post(c, m)
|
||||||
}
|
}
|
||||||
@@ -136,14 +136,14 @@ when ODIN_OS != .Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_cond_signal :: proc "contextless" (c: ^Cond) {
|
_cond_signal :: proc "contextless" (c: ^Cond) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_cond_signal_pre(c)
|
vg.helgrind_cond_signal_pre(c)
|
||||||
}
|
}
|
||||||
atomic_cond_signal(&c.impl.cond)
|
atomic_cond_signal(&c.impl.cond)
|
||||||
}
|
}
|
||||||
|
|
||||||
_cond_broadcast :: proc "contextless" (c: ^Cond) {
|
_cond_broadcast :: proc "contextless" (c: ^Cond) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_cond_broadcast_pre(c)
|
vg.helgrind_cond_broadcast_pre(c)
|
||||||
}
|
}
|
||||||
atomic_cond_broadcast(&c.impl.cond)
|
atomic_cond_broadcast(&c.impl.cond)
|
||||||
@@ -155,7 +155,7 @@ when ODIN_OS != .Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_rw_mutex_lock :: proc "contextless" (rw: ^RW_Mutex) {
|
_rw_mutex_lock :: proc "contextless" (rw: ^RW_Mutex) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_rwlock_lock_pre(rw, true)
|
vg.helgrind_rwlock_lock_pre(rw, true)
|
||||||
}
|
}
|
||||||
atomic_rw_mutex_lock(&rw.impl.mutex)
|
atomic_rw_mutex_lock(&rw.impl.mutex)
|
||||||
@@ -163,7 +163,7 @@ when ODIN_OS != .Windows {
|
|||||||
|
|
||||||
_rw_mutex_unlock :: proc "contextless" (rw: ^RW_Mutex) {
|
_rw_mutex_unlock :: proc "contextless" (rw: ^RW_Mutex) {
|
||||||
atomic_rw_mutex_unlock(&rw.impl.mutex)
|
atomic_rw_mutex_unlock(&rw.impl.mutex)
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_rwlock_unlock_post(rw, true)
|
vg.helgrind_rwlock_unlock_post(rw, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ when ODIN_OS != .Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_rw_mutex_shared_lock :: proc "contextless" (rw: ^RW_Mutex) {
|
_rw_mutex_shared_lock :: proc "contextless" (rw: ^RW_Mutex) {
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_rwlock_lock_pre(rw, false)
|
vg.helgrind_rwlock_lock_pre(rw, false)
|
||||||
}
|
}
|
||||||
atomic_rw_mutex_shared_lock(&rw.impl.mutex)
|
atomic_rw_mutex_shared_lock(&rw.impl.mutex)
|
||||||
@@ -181,7 +181,7 @@ when ODIN_OS != .Windows {
|
|||||||
|
|
||||||
_rw_mutex_shared_unlock :: proc "contextless" (rw: ^RW_Mutex) {
|
_rw_mutex_shared_unlock :: proc "contextless" (rw: ^RW_Mutex) {
|
||||||
atomic_rw_mutex_shared_unlock(&rw.impl.mutex)
|
atomic_rw_mutex_shared_unlock(&rw.impl.mutex)
|
||||||
when ODIN_ARCH == .amd64 {
|
when ODIN_VALGRIND_SUPPORT {
|
||||||
vg.helgrind_rwlock_unlock_post(rw, false)
|
vg.helgrind_rwlock_unlock_post(rw, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user