swiftlang / swift-corelibs-libdispatch

The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware
swift.org
Apache License 2.0
2.47k stars 460 forks source link

[SR-2107] LIBDispatch DispatchIO read Max Int not reading until EOF #733

Open swift-ci opened 8 years ago

swift-ci commented 8 years ago
Previous ID SR-2107
Radar None
Original Reporter sandmman (JIRA User)
Type Bug
Environment OSX Xcode 8
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 1 | |Component/s | libdispatch | |Labels | Bug, SDKOverlay | |Assignee | None | |Priority | Medium | md5: 8a4cf83f85fd0da59a4731c667e0be19

Issue Description:

Although the previous iteration of dispatch_io_read() allows you to pass the value SIZE_MAX as the length in order to read the entire file until an EOF character is reached, DispatchIO.read() no longer supports this. Instead giving the value ```Int.max``` leads the channel to wait indefinitely until the max size is available to read.

belkadan commented 8 years ago

Hm. Int.max is different from SIZE_MAX. I wonder if -1 would work, but that still may not be the interface we want for the "Swifty" Dispatch. mww (JIRA User), what do you think?

swift-ci commented 7 years ago

Comment by Riley Avron (JIRA)

Note that it's possible to get the "until EOF" behavior by passing Int(bitPattern: SIZE_MAX). Note too that there was an explicit decision to import size_t as Int. I'm not sure where that leaves us in terms of the right API here.

belkadan commented 7 years ago

cc ktopley-apple (JIRA User)

swift-ci commented 7 years ago

Comment by Kim Topley (JIRA)

Probably we should consider adding an explicit API for reading to end of file instead of relying on a particular length.

swift-ci commented 7 years ago

Comment by Kim Topley (JIRA)

Filed rdar://problem/34663502 to track this issue.