[gambit-list] web-repl.scm / concurrent read/writes
lowlycoder at huoyanjinjing.com
Mon Jun 22 15:02:49 EDT 2009
The following code (derived from simplifying web-repl.scm) _appears_ to work
(define s (open-tcp-server (list server-address: ""
(define-macro (forever . body)
`(let loop () , at body (loop)))
(let ((port1 (read s)))
(##make-repl-channel-ports port1 port1)))
however, I'm not sure if there's anything (like race conditions) that I've
introduced; and clearly we've lost support for important things like control
characters; besides that, any other problems? (I like it's sheer
On Mon, Jun 22, 2009 at 6:36 AM, Marc Feeley <feeley at iro.umontreal.ca>wrote:
> 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
>> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gambit-list