@@ -26,21 +26,25 @@ func poll(
2626 subscriptions: some Sequence < WASIAbi . Subscription > ,
2727 _ fdTable: FdTable
2828) 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
3134
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 ) )
4144
45+ }
4246 }
43- }
4447
45- poll ( & pollfds, . init( pollfds. count) , . init( timeoutMilliseconds) )
48+ poll ( & pollfds, . init( pollfds. count) , . init( timeoutMilliseconds) )
49+ #endif
4650}
0 commit comments