[dylan] Stream locking (was: Method combinations as a design pattern for locking)
Bruce Mitchener <[email protected]> Wed, 18 Dec 2013 08:59:07 +0700
| Newsgroups | gmane.comp.lang.dylan.gwydion.devel |
|---|---|
| Message-ID | <CA+esKjM-8dOqPf4PUPdzJporDnPzFRQ28pTzH4Mkg1iT0rBUKg@mail.gmail.com> |
Ingo, Part of the problem that you're having is that streams do locking internally now when they aren't supposed to do so. The original design documents for streams indicate that they are unlocked by default and that the application code should use stream locks (via with-stream-locked or stream-lock/unlock directly) when the stream may be accessed by multiple threads. Unfortunately, a couple of years ago, some locks were introduced to the streams library and I suspect that that has led to some issues over time. An example of that is that in the typical case of creating a <string-stream> for printing some data to it, we have to be sure that we create it unlocked (like in the date code in the system library), otherwise it can become a visible overhead when profiling. I'd like to see a return to streams being unlocked by default and applications which are threaded having to lock them as needed and as appropriate. One place where this would cause an issue is printing to *standard-output*. We can have format-out() do a with-stream-locked in that instance. Thoughts? - Bruce _______________________________________________ hackers mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/hackers