KQueue and Fibers

rashir rashir at rashir.com
Fri Apr 9 10:38:40 UTC 2021


On Friday, 9 April 2021 at 09:49:24 UTC, Arjan wrote:
> On Friday, 9 April 2021 at 09:00:17 UTC, rashir wrote:
>> Goodmorning everyone,
>> I'm trying to understand both Kqueue and Fiber's operation on 
>> Mac. Why don't I get the correct data as long as I read from 
>> the socket?
>> It seems to be reading too early, but Kquue tells me that the 
>> socket is readable.
>
> ...
>
>> yield for readibility
>> kqueue waiting for readibilty
>> resuming fiber as it's readable 131858
>> read bytesRead: -1readableAmount:131858 errno:35
>
> 35 == EAGAIN This informs the operation (recv) could not 
> complete without blocking and should be retried. This does not 
> mean the socket is not readable, but the operation would block 
> (for whatever reason).

Thank you, but I don't think I understand, it's not exactly 
KQueue's purpose to know when I can read in the socket without 
blocking myself?
Why just before the recv reported that there are 131858 bytes, 
while in reality it is not yet possible to read from the socket?
Thank you


More information about the Digitalmars-d-learn mailing list