mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
libuv: add more APIs
This commit is contained in:
@ -6,6 +6,7 @@ const Allocator = std.mem.Allocator;
|
||||
const testing = std.testing;
|
||||
const c = @import("c.zig");
|
||||
const errors = @import("error.zig");
|
||||
const Mutex = @import("Mutex.zig");
|
||||
|
||||
cond: *c.uv_cond_t,
|
||||
|
||||
@ -29,8 +30,12 @@ pub fn broadcast(self: Cond) void {
|
||||
c.uv_cond_broadcast(self.cond);
|
||||
}
|
||||
|
||||
pub fn wait(self: Cond) void {
|
||||
c.uv_cond_wait(self.cond);
|
||||
pub fn wait(self: Cond, mutex: Mutex) void {
|
||||
c.uv_cond_wait(self.cond, mutex.mutex);
|
||||
}
|
||||
|
||||
pub fn timedwait(self: Cond, mutex: Mutex, timeout: u64) c_int {
|
||||
return c.uv_cond_timedwait(self.cond, mutex.mutex, timeout);
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -79,6 +79,17 @@ pub fn now(self: Loop) u64 {
|
||||
return c.uv_now(self.loop);
|
||||
}
|
||||
|
||||
/// Update the event loop’s concept of “now”. Libuv caches the current time at
|
||||
/// the start of the event loop tick in order to reduce the number of time-related
|
||||
/// system calls.
|
||||
///
|
||||
/// You won’t normally need to call this function unless you have callbacks
|
||||
/// that block the event loop for longer periods of time, where “longer” is
|
||||
/// somewhat subjective but probably on the order of a millisecond or more.
|
||||
pub fn updateTime(self: Loop) void {
|
||||
return c.uv_update_time(self.loop);
|
||||
}
|
||||
|
||||
/// Sets loop->data to data.
|
||||
pub fn setData(self: Loop, pointer: ?*anyopaque) void {
|
||||
c.uv_loop_set_data(self.loop, pointer);
|
||||
|
Reference in New Issue
Block a user