@@ -26,21 +26,25 @@ func poll(
26
26
subscriptions: some Sequence < WASIAbi . Subscription > ,
27
27
_ fdTable: FdTable
28
28
) throws {
29
- var pollfds = [ pollfd] ( )
30
- var timeoutMilliseconds = UInt . max
29
+ #if os(Windows)
30
+ throw WASIAbi . Errno. ENOTSUP
31
+ #else
32
+ var pollfds = [ pollfd] ( )
33
+ var timeoutMilliseconds = UInt . max
31
34
32
- for subscription in subscriptions {
33
- let union = subscription. union
34
- switch union {
35
- case . clock( let clock) :
36
- timeoutMilliseconds = min ( timeoutMilliseconds, . init( clock. timeout / 1_000_000 ) )
37
- case . fdRead( let fd) :
38
- pollfds. append ( . init( fd: try fdTable. fileDescriptor ( fd: fd) . rawValue, events: . init( POLLIN) , revents: 0 ) )
39
- case . fdWrite( let fd) :
40
- pollfds. append ( . init( fd: try fdTable. fileDescriptor ( fd: fd) . rawValue, events: . init( POLLOUT) , revents: 0 ) )
35
+ for subscription in subscriptions {
36
+ let union = subscription. union
37
+ switch union {
38
+ case . clock( let clock) :
39
+ timeoutMilliseconds = min ( timeoutMilliseconds, . init( clock. timeout / 1_000_000 ) )
40
+ case . fdRead( let fd) :
41
+ pollfds. append ( . init( fd: try fdTable. fileDescriptor ( fd: fd) . rawValue, events: . init( POLLIN) , revents: 0 ) )
42
+ case . fdWrite( let fd) :
43
+ pollfds. append ( . init( fd: try fdTable. fileDescriptor ( fd: fd) . rawValue, events: . init( POLLOUT) , revents: 0 ) )
41
44
45
+ }
42
46
}
43
- }
44
47
45
- poll ( & pollfds, . init( pollfds. count) , . init( timeoutMilliseconds) )
48
+ poll ( & pollfds, . init( pollfds. count) , . init( timeoutMilliseconds) )
49
+ #endif
46
50
}
0 commit comments