I've implemented some NULL schannel stuff. You can now make a NULL schannel, which helps to make schannels unreachable. For example you can do:
var chan = mk_schannel[int] (); ,,, chan = _unsafe_mk_null_schannel[int] (); to make chan unreachable from the global scope. [It may or may not be reachable elsewhere]. The read and write operators now check for NULL schannels and abort the program with an exception if asked to use one. However this raises the interesting question, would it not be better to do this: read -- locks up forever write -- does nothing OR write: locks up forever instead of throwing an exception. There's a good reason to think this is correct. If there is no writer for an schannel, a reader will lock up anyhow. This is a design feature not a bug :) Because the fibre doing the read is de-scheduled when there's no data to read, and rescheduled when there is. This is done by hanging the reader onto the schannel. When the write occurs it is pulled off the channel and rescheduled to process data. If there is no other reachable owner of the channel, the reader is deadlocked. However if there is no reachable owner of the reader fibre, the reader can be reaped (because it unreachable). So the read operation is semantically a suicide, which means the reader cannot be deadlocked .. since it doesn't exist :) Write operations are similar. Now, if we treat a NULL schannel as an actual channel, and we agree the semantics are that every NULL channel is distinct, then a read should work exactly the same way as if there were no writer because that follows from the specification. So read should not throw an exception, it should instead just cause the reading fibre to suicide (assuming there are no reachable owners of the fibre). Similarly, write should lock up forever too. (Not simply do nothing?) The primary difference from an implementation viewpoint is this: I can implement exception throwing in the Felix library. I cannot implement lockup in Felix, it has to be done in the C++ RTL. The implementation is interesting: we just deschedule the calling thread. Interesting. It HAS to be right!! In particular it means NULL channels are NOT unsafe! -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language