[plt-scheme] Q. about editor<%> internal-locks

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Oct 7 17:06:28 EDT 2009

At Wed, 7 Oct 2009 16:56:05 -0400, Ryan Culpepper wrote:
> On Oct 7, 2009, at 4:16 PM, Matthew Flatt wrote:
> 
> > At Wed, 7 Oct 2009 12:58:31 -0700, John Clements wrote:
> >> On Oct 7, 2009, at 12:31 PM, Robby Findler wrote:
> >>
> >>> Are you accessing the editor from more than one thread?
> >>
> >> No.  In particular, the only references to this editor are
> >>
> >> 1) it's embedded in a canvas which is part of a visible pane, and
> >> 2) There's an "update" method that is called by only one thread.
> >
> > So the "one thread" in #2 is the same as the canvas's eventspace's
> > handler thread?
> 
> Does the canvas have its own eventspace, or does it use the frame's  
> eventspace?

It's always the frame's eventspace.

> What's the right way to modify the editor in a thread other than the  
> eventspace handler thread?

Wrap the modifications with `begin-edit-sequence' and
`end-edit-sequence'. An edit sequence takes a lock that is also used by
the repaint method of an editor.

(I think that might be the answer for John, but only if he meant "Yes"
instead of "No" in answering Robby's question.)



Posted on the users mailing list.