mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add ConditionVariable.wait_until and ConditionVariable.wait_for (#2302)
* Add `ConditionVariable.wait_until` and `ConditionVariable.wait_for` * Add "@structlike" for typedefs. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
committed by
GitHub
parent
448176b0b7
commit
2053f2767b
@@ -23,7 +23,7 @@ macro void @loop_over_ai(AddrInfo* ai; @body(NativeSocket fd, AddrInfo* ai))
|
||||
}
|
||||
}
|
||||
|
||||
const Duration POLL_FOREVER = -1;
|
||||
const Duration POLL_FOREVER = (Duration)-1;
|
||||
|
||||
typedef PollSubscribes = ushort;
|
||||
typedef PollEvents = ushort;
|
||||
|
||||
@@ -5,11 +5,11 @@ import std::time, libc;
|
||||
typedef TcpSocket = inline Socket;
|
||||
typedef TcpServerSocket = inline Socket;
|
||||
|
||||
fn TcpSocket? connect(String host, uint port, Duration timeout = 0, SocketOption... options, IpProtocol ip_protocol = UNSPECIFIED)
|
||||
fn TcpSocket? connect(String host, uint port, Duration timeout = time::DURATION_ZERO, SocketOption... options, IpProtocol ip_protocol = UNSPECIFIED)
|
||||
{
|
||||
AddrInfo* ai = net::addrinfo(host, port, ip_protocol.ai_family, os::SOCK_STREAM)!;
|
||||
defer os::freeaddrinfo(ai);
|
||||
if (timeout > 0)
|
||||
if (timeout > time::DURATION_ZERO)
|
||||
{
|
||||
return (TcpSocket)net::connect_with_timeout_from_addrinfo(ai, options, timeout)!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user