[gambit-list] web-repl.scm / concurrent read/writes
Marc Feeley
feeley at iro.umontreal.ca
Mon Jun 22 09:36:26 EDT 2009
On 21-Jun-09, at 11:14 PM, lowly coder wrote:
> Looking at the web-repl.scm file in gambc/examples, I often see
> situations of:
>
> lock mutex
> write single char
> flush output
> unlock mutex
>
> Why is this necessary? According to the gambit documentation, ports
> have to be written to handle concurrent read/writes themselves.
The locking is not needed in web-repl.scm . It is there because the
code is left over from an implementation of the telnet protocol where
I believe exclusive access to the terminal was needed.
Note that the Gambit specs say that *individual calls* to write-char
need no locking. But if you want a sequence of calls to write-char to
appear uninterrupted, then you need a lock.
Marc
More information about the Gambit-list
mailing list