1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: rename [ref_only] -> [heap] (#8718)

This commit is contained in:
Uwe Krüger
2021-02-13 15:52:01 +01:00
committed by GitHub
parent 2a8d0ddaf5
commit 374739b804
20 changed files with 40 additions and 36 deletions

View File

@ -28,12 +28,12 @@ fn C.sem_timedwait(voidptr, voidptr) int
fn C.sem_destroy(voidptr) int
// [init_with=new_mutex] // TODO: implement support for this struct attribute, and disallow Mutex{} from outside the sync.new_mutex() function.
[ref_only]
[heap]
pub struct Mutex {
mutex C.pthread_mutex_t
}
[ref_only]
[heap]
pub struct RwMutex {
mutex C.pthread_rwlock_t
}
@ -42,7 +42,7 @@ struct RwMutexAttr {
attr C.pthread_rwlockattr_t
}
[ref_only]
[heap]
struct Semaphore {
sem C.sem_t
}

View File

@ -31,12 +31,12 @@ fn C.pthread_cond_timedwait(voidptr, voidptr, voidptr) int
fn C.pthread_cond_destroy(voidptr) int
// [init_with=new_mutex] // TODO: implement support for this struct attribute, and disallow Mutex{} from outside the sync.new_mutex() function.
[ref_only]
[heap]
pub struct Mutex {
mutex C.pthread_mutex_t
}
[ref_only]
[heap]
pub struct RwMutex {
mutex C.pthread_rwlock_t
}
@ -51,7 +51,7 @@ struct CondAttr {
/* MacOSX has no unnamed semaphores and no `timed_wait()` at all
so we emulate the behaviour with other devices */
[ref_only]
[heap]
struct Semaphore {
mtx C.pthread_mutex_t
cond C.pthread_cond_t

View File

@ -22,19 +22,19 @@ type SHANDLE = voidptr
//[init_with=new_mutex] // TODO: implement support for this struct attribute, and disallow Mutex{} from outside the sync.new_mutex() function.
// `SRWLOCK` is much more performant that `Mutex` on Windows, so use that in both cases since we don't want to share with other processes
[ref_only]
[heap]
pub struct Mutex {
mut:
mx C.SRWLOCK // mutex handle
}
[ref_only]
[heap]
pub struct RwMutex {
mut:
mx C.SRWLOCK // mutex handle
}
[ref_only]
[heap]
struct Semaphore {
mtx C.SRWLOCK
cond C.CONDITION_VARIABLE

View File

@ -18,7 +18,7 @@ fn C.atomic_fetch_add_u32(voidptr, u32) u32
// `wg.done()` when finished
//
// [init_with=new_waitgroup] // TODO: implement support for init_with struct attribute, and disallow WaitGroup{} from outside the sync.new_waitgroup() function.
[ref_only]
[heap]
struct WaitGroup {
mut:
task_count u32 // current task count - reading/writing should be atomic