guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: PATCH - Add cooperative REPL server module


From: Thompson, David
Subject: Fwd: PATCH - Add cooperative REPL server module
Date: Mon, 20 Jan 2014 18:36:05 -0500

Forgot to CC the list about my updated patch. Forwarding instead. My apologies.

- Dave


---------- Forwarded message ----------
From: David Thompson <address@hidden>
Date: Mon, Jan 20, 2014 at 6:31 PM
Subject: Re: PATCH - Add cooperative REPL server module
To: Mark H Weaver <address@hidden>


Mark H Weaver <address@hidden> writes:

> That means that they'll all run in the same thread.  A great benefit of
> the cooperative REPL is being able to safely access and mutate data
> structures belonging to a particular thread.  A program may have more
> than one thread, and may want REPLs for each.
>
> Also, remember that Guile is a library, and may be used by multiple
> libraries within a larger program.  Each of those libguile-using
> libraries may want to provide their own coop REPL server, each run at
> their own chosen safe-points.
>
> As a general rule, in _any_ library, it's generally a bad idea to have
> global settings.  For example, the GMP library that Guile uses for big
> integers offers global settings to specify custom memory allocation
> functions, and Guile needs to set these.  However, this can lead to
> conflicts when other libraries linked with libguile (or the main
> program) also use GMP and want to install their own custom allocators.

Good points. Thanks for the explanation.

> Okay.  I wouldn't expect it to work without modifications.

I have wrapped the body of 'start-coop-repl' with 'false-if-exception'
to prevent the program from crashing with 'stop-server-and-clients!' is
called from a REPL.  I did not have to do the same for 'close-socket!'
in 'start-repl-client' because trying to close an a port that has
already been closed is a no-op.

However, something unexpected happened when I tried to call
'stop-server-and-clients!' from my test program's main loop: There was a
segfault once I pressed the enter key in my telnet REPL session.  I
tested this again with the regular REPL server and got the same bad
results.  Thoughts?

In any case, attached is an updated patch for review.  Multiple
cooperative REPL servers are now supported and the global evaluation
mvar has been removed.

- Dave

Attachment: 0001-Add-cooperative-REPL-server-module.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]