Re: [dylan] stream locking: opt-in or opt-out?

Hannes Mehnert <[email protected]> Sat, 03 Aug 2013 15:03:23 +0200
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA384

On 08/01/2013 05:39, Bruce Mitchener wrote:
> Currently, all streams default to having a lock and requiring that
> people opt out of being locked:
> 
> slot private-stream-lock-value :: false-or(<lock>) = 
> make(<recursive-lock>), init-keyword: stream-lock:;
> 
> I think there is a reasonable case to be made that streams could or
> should default to being unlocked and allow people who know they
> need locking to opt into locking and give them an appropriate lock
> (or make the init-keyword be locked?: and use that to set the
> stream-lock).
> 
> Obviously, some streams should be locked by default, like the
> standard-io streams for stdin, stdout, stderr.
> 
> Short of that, we could do something like defaulting all
> string-streams to be unlocked, but that seems more confusing to
> document to me.
> 
> What do other people think?


I remember to have defaulted to make(<recursive-lock>) instead of #f
with Andreas several years ago. Reasoning was that we were fixing
multi-threaded applications (I believe mainly during gtk-duim work)
and it was painful to debug.
Our rationale was "better safe than sorry", which I still think should
be the case.
I think <string-stream> should not be locked by default.

I also envision a compiler optimization which looks whether the stream
escapes or is local and if so, the compiler can remove the locking...

Hannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iQIcBAEBCQAGBQJR/P+bAAoJELyJZYjffCju6XoP/2g4YLLmjw7Ehse2nf9gdQ+j
I/n8GaPLafm9lDuG2x3HWEtLHBEFdF9FSzBP35DJfk8ht69l7ej57ngQW2iGEzmE
pCan0QKGMQU8m83cNDF0MMUZFLltbVtMe4+CsvSmzmVGjYv1NuAvOxIf1rLZaUe3
QxiLRozAc4WF91E/HQ/AV6UudQ7uryHB0n8fK5EYuK4kq/P0ZRZOkBE9vg6Hu0vb
EmwfccTOA4xXrogGpzcqBrD3RMiet/bNmpnKwvEmiGHwE4LCQ5zM/NaGaBadjv5i
vZWR1otZBvXx12hFkWl04P/5Ao6KSbeR+uYk5cyUjAbDPBqcg8Y74ru3KfXTGf1P
piG+xSVwTtEpOUxokrl3k3E6xb+XNk814WBPFCRbrlwjxqv0H5ZHNgQgtIY6LctA
OkCrNcXAaWHVqL2kmiRosHnQlhQXhuKK9O/1QsTmEYGY8J0vM3z0u+iCixtkznS2
RFZhyD998XaC0gNTQxipKVsv1eoJHuKZeGb2lz8HRozlzqBTqqrGoiXbMTCWGSTz
e1n9mI7U2xDHVwKTjm1/HPJlq+NeZ5uwpZn5YlNQ3OkcdYb8/ywVlDJ3kKxHR5Ze
nbwuOccmw5IlwjAVbO+13y7zssLtKl1KE5Qv/S0ssPIEW+IPo2xN1+eTZQMX+AQX
w5JN0kAP9W6vyDJ1t7ao
=OEAm
-----END PGP SIGNATURE-----
_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers