[Mono-devel-list] FileStream.BeginRead() blocks when no data is present.
Howdy, 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 ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-devel-list] Compiler warnings: what to report (Re: System.XML warning)
Hello, Marek Safar wrote: Hello, Comments in lined. System.Xml/XmlReader.cs(1051) warning CS0169: The private method 'System.Xml.XmlReader.CheckSupport()' is never used This is used in NET_2_0 part of code. Should we enclose ALL of such members in _nasty_ preprocessor directives? Does it ease developers read it? Yes, it is easier to read and easier to maintain. If you don't enclose your members in #if NET_2_0 directive how can I know that a field is not valid for NET_1_x ?. I have to search in your code and try to find out whether the field is valid or not. IMO having ifdefs are much more nasty than just having unused fields. If there are ifdefs in effect, in every block (not only field declarations) you must grep up to find whether it is valid block or not. If those warning output REALLY annoys developers, I'd just add /nowarn:169 as well as 162, 612 and 618. System.Xml/XmlTextReader.cs(1672) warning CS0168: The variable 'dummyValue' is declared but never used It is _required_ even though it is actually not used (otherwise mcs/csc will reject this code). CSC never reports it as warning and I think that regarding it as a warning is bad design. Is it some managed - unmanaged work ? If you tried to remove that assignment statement for the dummy value, csc will complain that: System.Xml\XmlTextReader.cs(1674,23): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement and mcs saying that: syntax error, got token `SEMICOLON' System.Xml\XmlTextReader.cs(1674) error CS1002: Expecting `;' Well, aside this code, there is possibility that those extra fields might be used from other assemblies. For example, I used to have XQueryCommandImpl type and field in System.Xml.dll and referenced it from System.Data.SqlXml.dll via reflection. System.Xml.Xsl/XslTransform.cs(604) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xsltCleanupGlobals()' is never used System.Xml.Xsl/XslTransform.cs(611) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlNewDoc( string)' is never used System.Xml.Xsl/XslTransform.cs(614) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlSaveFile( string, System.IntPtr)' is never used System.Xml.Xsl/XslTransform.cs(626) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlCleanupParser()' is never used System.Xml.Xsl/XslTransform.cs(629) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlDocDumpMemory( System.IntPtr, ref System.IntPtr, ref int)' is never used System.Xml.Xsl/XslTransform.cs(632) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlFree( System.IntPtr)' is never used System.Xml.Xsl/XslTransform.cs(649) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.valuePop( System.IntPtr)' is never used System.Xml.Xsl/XslTransform.cs(652) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.valuePush( System.IntPtr, System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(655) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathFreeObject( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(658) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewCString( string)' is never used System.Xml.Xsl/XslTransform.cs(661) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewFloat( double)' is never used System.Xml.Xsl/XslTransform.cs(664) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewBoolean( int)' is never used System.Xml.Xsl/XslTransform.cs(667) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewNodeSet( System.IntPtr)' is never used System.Xml.Xsl/XslTransform.cs(670) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToBoolean( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(673) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToNumber( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(676) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToString( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(679) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathStringFunction( System.IntPtr, int)' is never used Why are they reported as never used? They are actually in use. Are you sure that they are used ? I tried to remove 'System.Xml.Xsl.UnmanagedXslTransform.xsltCleanupGlobals' and no compilation error. Mmm, sorry then I should have checked more in details. At least
Re: [Mono-devel-list] Compiler warnings: what to report (Re: System.XML warning)
Hello, System.Xml/XmlReader.cs(1051) warning CS0169: The private method 'System.Xml.XmlReader.CheckSupport()' is never used This is used in NET_2_0 part of code. Should we enclose ALL of such members in _nasty_ preprocessor directives? Does it ease developers read it? Yes, it is easier to read and easier to maintain. If you don't enclose your members in #if NET_2_0 directive how can I know that a field is not valid for NET_1_x ?. I have to search in your code and try to find out whether the field is valid or not. IMO having ifdefs are much more nasty than just having unused fields. If there are ifdefs in effect, in every block (not only field declarations) you must grep up to find whether it is valid block or not. I respect your opinion but I really don't like searching in not my code and looking in which .NET version is this variable available. BTW, You can use partial classes for really ugly constructs. If those warning output REALLY annoys developers, I'd just add /nowarn:169 as well as 162, 612 and 618. I am not sure whether every developer is annoyed by these warnings. System.Xml/XmlTextReader.cs(1672) warning CS0168: The variable 'dummyValue' is declared but never used It is _required_ even though it is actually not used (otherwise mcs/csc will reject this code). CSC never reports it as warning and I think that regarding it as a warning is bad design. Is it some managed - unmanaged work ? If you tried to remove that assignment statement for the dummy value, csc will complain that: System.Xml\XmlTextReader.cs(1674,23): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement and mcs saying that: syntax error, got token `SEMICOLON' System.Xml\XmlTextReader.cs(1674) error CS1002: Expecting `;' I will have a look what is going here. Well, aside this code, there is possibility that those extra fields might be used from other assemblies. For example, I used to have XQueryCommandImpl type and field in System.Xml.dll and referenced it from System.Data.SqlXml.dll via reflection. OK, then please declare this field/method as internal. It is easier to see that the field is hacked from outside. System.Xml.Xsl/XslTransform.cs(604) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xsltCleanupGlobals()' is never used System.Xml.Xsl/XslTransform.cs(611) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlNewDoc( string)' is never used System.Xml.Xsl/XslTransform.cs(614) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlSaveFile( string, System.IntPtr)' is never used System.Xml.Xsl/XslTransform.cs(626) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlCleanupParser()' is never used System.Xml.Xsl/XslTransform.cs(629) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlDocDumpMemory( System.IntPtr, ref System.IntPtr, ref int)' is never used System.Xml.Xsl/XslTransform.cs(632) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlFree( System.IntPtr)' is never used System.Xml.Xsl/XslTransform.cs(649) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.valuePop( System.IntPtr)' is never used System.Xml.Xsl/XslTransform.cs(652) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.valuePush( System.IntPtr, System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(655) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathFreeObject( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(658) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewCString( string)' is never used System.Xml.Xsl/XslTransform.cs(661) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewFloat( double)' is never used System.Xml.Xsl/XslTransform.cs(664) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewBoolean( int)' is never used System.Xml.Xsl/XslTransform.cs(667) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathNewNodeSet( System.IntPtr)' is never used System.Xml.Xsl/XslTransform.cs(670) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToBoolean( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(673) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToNumber( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(676) warning CS0169: The private method 'System.Xml.Xsl.UnmanagedXslTransform.xmlXPathCastToString( System.Xml.Xsl.UnmanagedXslTransform.xpathobject*)' is never used System.Xml.Xsl/XslTransform.cs(679) warning CS0169: The private method
Re: [Mono-devel-list] Preparing the 1.1.5 release.
Hi, I am preparing the 1.1.5 release; Please let me know what features should be highlighted in this new release since our 1.1.4 release. Being happy with gcc4 would be one - it's important for the FC4 release. Other than that, MWF being closer to being properly usable, it's faster than ever and to read the latest LXF for the interview with Miguel ;-p TTFN Paul -- It is often said that something cannot be libel if it is the truth. This has had to be amended to 'something cannot be libel if it is the truth or if the bank balance says otherwise' - US Today signature.asc Description: This is a digitally signed message part
Re: [Mono-devel-list] Preparing the 1.1.5 release.
Hello, Miguel de Icaza wrote: Hello, I am preparing the 1.1.5 release; Please let me know what features should be highlighted in this new release since our 1.1.4 release. XML: - XSLT QA task; Andrew Skiba and Konstantin Triger from Mainsoft fixed several bugs on XSLT, DOM and XmlReaders. - Significant XSLT memory usage reduction has done (and it's still ongoing). - Now we have ISO DSDL Part 4 NVDL support as part of Commons.Xml.Relaxng.dll, accompanying several bugfixes on RELAX NG support. Atsushi Eno ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-devel-list] Using anonymous delegates with Cocoa-Sharp...
I noticed that mcs now supports anonymous delegates, so I tried experimenting in monodoc: delegate void Action(); [Export(goForward:)] public void goForward(object sender) { WebBackForwardList history = webView.backForwardList; Action a = delegate { if (history.forwardListCount 0) { history.goForward(); loadHistoryItem(history.currentItem); } }; a(); } When the delegate executes, this crashes the process (see stack crawl at end). Presumably it's the access the local variable history that's crashing, because if I change the code to this it doesn't crash: [Export(goForward:)] public void goForward(object sender) { Action a = delegate { WebBackForwardList history = webView.backForwardList; if (history.forwardListCount 0) { history.goForward(); loadHistoryItem(history.currentItem); } }; a(); } Is this feature fully supported or only partially implemented? - Patrick Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x Thread 0 Crashed: 0 0x05e71464 0 + 0x5e71464 1 0x05e718a8 0 + 0x5e718a8 2 0x05e71804 0 + 0x5e71804 3 0x05e716c0 0 + 0x5e716c0 4 0x05e70c38 0 + 0x5e70c38 5 mono 0x000613a8 mono_runtime_invoke_array + 0x2a4 (object.c:1909) 6 mono 0x00079788 ves_icall_InternalInvoke + 0x294 (icall.c:2370) 7 0x017ae9d8 0 + 0x17ae9d8 8 0x017ae1f4 0 + 0x17ae1f4 9 0x017ad350 0 + 0x17ad350 10 0x017acd64 0 + 0x17acd64 11 0x05e67b50 0 + 0x5e67b50 12 0x05d26530 0 + 0x5d26530 13 0x030d55a8 0 + 0x30d55a8 14 libCocoaSharpGlue.dylib 0x011ec1cc glue_forwardInvocation + 0x16c (Glue.m:260) 15 com.apple.Foundation 0x909fcfd0 -[NSObject(NSForwardInvocation) forward::] + 0x198 16 libobjc.dylib 0x90836810 _objc_msgForward + 0xb0 17 libobjc.dylib 0x90836734 objc_msgSendv + 0xb4 18 libCocoaSharpGlue.dylib 0x011ec458 glue_implementMethod + 0x24c (Glue.m:308) 19 com.apple.AppKit 0x92e78224 -[NSApplication sendAction:to:from:] + 0x6c 20 com.apple.AppKit 0x92eada44 -[NSMenu performActionForItemAtIndex:] + 0x188 21 com.apple.AppKit 0x92ef22e4 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 0x68 22 com.apple.AppKit 0x92ef8c14 -[NSMenu performKeyEquivalent:] + 0x104 23 com.apple.AppKit 0x92ed7ccc -[NSApplication _handleKeyEquivalent:] + 0x124 24 com.apple.AppKit 0x92df53dc -[NSApplication sendEvent:] + 0xa5c 25 com.apple.AppKit 0x92dfdc54 -[NSApplication run] + 0x240 26 0x05e6b320 0 + 0x5e6b320 27 0x05e6b1ac 0 + 0x5e6b1ac 28 mono 0x000613a8 mono_runtime_invoke_array + 0x2a4 (object.c:1909) 29 mono 0x00079788 ves_icall_InternalInvoke + 0x294 (icall.c:2370) 30 0x017ae9d8 0 + 0x17ae9d8 31 0x017ae1f4 0 + 0x17ae1f4 32 0x017ad350 0 + 0x17ad350 33 0x017acd64 0 + 0x17acd64 34 0x011e4ac8 0 + 0x11e4ac8 35 0x05e6b0f4 0 + 0x5e6b0f4 36 0x05e6b078 0 + 0x5e6b078 37 0x004c7344 0 + 0x4c7344 38 0x004c7088 0 + 0x4c7088 39 0x004c640c 0 + 0x4c640c 40 mono 0x0006105c mono_runtime_exec_main + 0x110 (object.c:1766) 41 mono 0x00060cac mono_runtime_run_main + 0x210 (object.c:1628) 42 mono 0x40d8 mono_main + 0x91c (driver.c:893) 43 mono 0x2468 _start + 0x188 (crt.c:267) 44 dyld 0x8fe1a558 _dyld_start + 0x64 ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] Embedding Mono in a Virtual World
--- Willibald Krenn [EMAIL PROTECTED] wrote: Is it possible to save and load mono stacks? I don't think this will work. You'd have to guarantee that all code (JIT compiled methods) is at the same place, the methods are actually compiled, all VMTs are correctly initialized, ... Hmm. I was hoping that I'd be able to store the stack in terms of CIL methods and offsets, then rebuild it at the other end. Couldn't it be made to work in a similar way to a debugger? If code locations and and ensuring compilation are a problem, could I compile ahead of time and ship the binary around between servers? (What about all the objects on the heap?) I was planing to compile each script as a single object, so if I transfer the script object and it's stack I will have everything the script needs at the other end. Cheers, Jim. Send instant messages to your online friends http://uk.messenger.yahoo.com ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] Embedding Mono in a Virtual World
--- Rodrigo B. de Oliveira [EMAIL PROTECTED] wrote: You might be able to cook up something with serializable objects and lightweight threads based on generators (yield) But this is just food for though... Yes, this is the other option. You end up with something that looks like PicoThreads for Java, or some of the other Java systems for serializing running threads. It boils down to builing continuations on the heap instead of using the stack. As the continuation objects are just objects you can serialize them like any other object. Then you just need to turn every method in to a state machine so you can jump to any point in the method. This is lots of work though and has a big impact on performance, so I'm hoping I don't have to go there. Trying to use debugging APIs to do this sounds like it might be an easier first option. Cheers, Jim. Send instant messages to your online friends http://uk.messenger.yahoo.com ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] J# vs ikvm
Todd Berman wrote: On Fri, 2005-03-18 at 21:49 +0100, Massimiliano Mantione wrote: On Fri, 2005-03-18 at 20:43, Charlie Ford wrote: Assembly '/home/charlie/mono-foo/vjslib.dll' has the non-standard metadata heap #-. No promise that this will work, but in theory you can on windows, use ildasm to output a .il file of vjslib.dll and then use ilasm to put it back together with a standard metadata heap. Most likely this violates EULAs and other various stuff, so do whatever you wish :) --Todd Anyway, the vjslib assembly relies one so many unmanaged Windows stuff that it won't be usable with Mono on Linux. Jb ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-devel-list] Embedding Mono in a Virtual World
I don't see how this could possibly work if the managed code objects you are trying to persist deal in any way with resources outside of the managed world. For instance, I assume threads are implemented as either some pthreads based objects or some windows threads objects (in the kernel sense of the word object, of course) and you cannot possibly expect anything running in the managed world to know how to persist these things unless the managed objects specifically know how to do this (i.e. are designed to support this functionality). Or am I missing the point? --- Jim Purbrick [EMAIL PROTECTED] wrote: --- Rodrigo B. de Oliveira [EMAIL PROTECTED] wrote: You might be able to cook up something with serializable objects and lightweight threads based on generators (yield) But this is just food for though... Yes, this is the other option. You end up with something that looks like PicoThreads for Java, or some of the other Java systems for serializing running threads. It boils down to builing continuations on the heap instead of using the stack. As the continuation objects are just objects you can serialize them like any other object. Then you just need to turn every method in to a state machine so you can jump to any point in the method. This is lots of work though and has a big impact on performance, so I'm hoping I don't have to go there. Trying to use debugging APIs to do this sounds like it might be an easier first option. Cheers, Jim. Send instant messages to your online friends http://uk.messenger.yahoo.com ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list