mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Updating time duration functions.
This commit is contained in:
@@ -54,6 +54,11 @@ struct Poll
|
||||
PollEvents revents;
|
||||
}
|
||||
|
||||
fn ulong! poll_ms(Poll[] polls, long timeout_ms)
|
||||
{
|
||||
return poll(polls, time::ms(timeout_ms)) @inline;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param [inout] polls
|
||||
* @param timeout "duration to poll."
|
||||
|
||||
@@ -14,3 +14,15 @@ fn UdpSocket! connect_to(AddrInfo* ai, SocketOption... options)
|
||||
{
|
||||
return (UdpSocket)net::connect_from_addrinfo(ai, options);
|
||||
}
|
||||
|
||||
fn UdpSocket! connect_async(String host, uint port, SocketOption... options, IpProtocol protocol = UNSPECIFIED)
|
||||
{
|
||||
AddrInfo* ai = net::addrinfo(host, port, protocol.ai_family, os::SOCK_DGRAM)!;
|
||||
defer os::freeaddrinfo(ai);
|
||||
return connect_async_to(ai, ...options);
|
||||
}
|
||||
|
||||
fn UdpSocket! connect_async_to(AddrInfo* ai, SocketOption... options)
|
||||
{
|
||||
return (UdpSocket)net::connect_async_from_addrinfo(ai, options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user