[Mono-devel-list] FileStream.BeginRead() blocks when no data is present.

Martin Murray mmurray at deepthought.org
Fri Mar 18 00:05:58 EST 2005


    I wrote up a class to use the inotify interface. I create a
FileStream instance and open "/dev/notify". After issuing an ioctl, I
initiate an async read with FileStream.BeginRead().
FileStream.BeginRead() appears to block until the kernel has written
information to /dev/notify. This seems to be the same as the bug
described at http://bugzilla.ximian.com/show_bug.cgi?id=41193

    I disagree with the bug reviewers conclusion that this is not a bug.
There is nothing in the documentation of BeginRead to suggest that it
would block, however, EndRead does note that EndRead will block until
there is at least 1 byte of data available.

    After asking #mono on irc.gimp.net, cmorgan and I agreed that
FileStream.BeginRead() is hardly asynchronous if it blocks. If blocking
is really the intended behavior, could the documentation be ammended to
state that? 

    Btw, the example code in the above bugid blocks on v1.1 of .NET,
however, it does not block on v2.0.40607 of the framework. 

    I'd include test code, but it requires the inotify patch, however, I
will send it to anyone who asks for it.

Regards, Martin

More information about the Mono-devel-list mailing list