[Mono-dev] some doubts on WinSerialStream
Atsushi Eno
atsushieno at veritas-vos-liberabit.com
Wed Apr 22 11:12:33 EDT 2009
Hello,
I have been playing with gainer (http://gainer.cc) these days.
A friend of mine wrote a pure C# controller over it,
http://svn.artonx.org/repos/trunk/MnGainer/
and I of course wanted to get it working with mono.
I also have simpler test executable (testgainer.cs, attached;
compile with: gmcs testgainer.cs MnGainer/*.cs).
First I tried it on Linux but it didn't work. But I do not seem to
have working environment even with processing or flash (they are
known to work) after all, I switched to windows and mac where
I already got them working. However it didn't work neither.
I dug in depth and I have sort of fix on Win32SerialStream, as
the attached patch. However it should not be applied blindly.
Basically it tried to continue reading by GetOverlappedResult()
while it results in 0 bytes read.
The problem I experienced with gainer is that no matter how
GetOverlappedResult() is documented as to not return results until
the operation completes when bWait flag is true,
http://msdn.microsoft.com/en-us/library/ms683209(VS.85).aspx
It actually returns immediately, with 0 bytes results.
I assume that Win32 should take timeouts into GetOverlappedResult()
results, so it may be safe to just go into infinite loop until
GetOverlappedResult() returns non-zero byte results, or win32 error.
I also assume that Timeouts class has some wrong values for
ReadXxx fields, but I have no behavioral problem because of those
values that as far as I know (it is also documented as doubtful).
The problem above might be because of these incorrect values.
Anyways with the attached patch I could get gainer working on
mono/win32. Since .NET has no problem on running those example
exe files, the problem would rather be in mono, not other sides.
Do you guys have any other ideas for attempts I should try? I guess
not many people can try the app anyways (you need gainer!).
Atsushi Eno
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: win32ports-readblocker.patch
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090423/23ec0dd6/attachment.pl
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testgainer.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090423/23ec0dd6/attachment-0001.pl
More information about the Mono-devel-list
mailing list