mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sync: use Event for waitgroup on windows
This commit is contained in:
22
vlib/sync/waiter_nix.c.v
Normal file
22
vlib/sync/waiter_nix.c.v
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2019 Alexander Medvednikov. All rights reserved.
|
||||
// Use of this source code is governed by an MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
module sync
|
||||
|
||||
[ref_only]
|
||||
struct Waiter{
|
||||
mut:
|
||||
mx &Mutex
|
||||
}
|
||||
|
||||
pub fn (mut w Waiter) wait() {
|
||||
w.mx.lock()
|
||||
}
|
||||
|
||||
pub fn (mut w Waiter) stop() {
|
||||
w.mx.unlock()
|
||||
}
|
||||
pub fn new_waiter() &Waiter {
|
||||
w := &Waiter{mx: new_mutex()}
|
||||
return w
|
||||
}
|
||||
Reference in New Issue
Block a user