mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sync: add Mutex.destroy and RwMutex.destroy methods (#18351)
This commit is contained in:
20
vlib/v/slow_tests/valgrind/sync.v
Normal file
20
vlib/v/slow_tests/valgrind/sync.v
Normal file
@@ -0,0 +1,20 @@
|
||||
import sync
|
||||
|
||||
fn main() {
|
||||
mut mutex := sync.new_mutex()
|
||||
mutex.@lock()
|
||||
mutex.unlock()
|
||||
mutex.destroy()
|
||||
|
||||
mut rwmutex := sync.new_rwmutex()
|
||||
rwmutex.@rlock()
|
||||
rwmutex.unlock()
|
||||
rwmutex.@lock()
|
||||
rwmutex.unlock()
|
||||
rwmutex.destroy()
|
||||
|
||||
mut sem := sync.new_semaphore()
|
||||
sem.post()
|
||||
sem.wait()
|
||||
sem.destroy()
|
||||
}
|
||||
Reference in New Issue
Block a user