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

23 lines
393 B
V

// 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.m_lock()
}
pub fn (mut w Waiter) stop() {
w.mx.unlock()
}
pub fn new_waiter() &Waiter {
w := &Waiter{mx: new_mutex()}
return w
}