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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Oct 7 15:31:22 EDT 2009

Are you accessing the editor from more than one thread?


On Wed, Oct 7, 2009 at 2:25 PM, John Clements <clements at brinckerhoff.org> wrote:
> The stepper is triggering sequence-contract violations, and I've tracked it
> down to a text% that's *internally locked*.  My question is this: what's the
> right way to deal with this? Should I just poll until the text% is no longer
> internally locked?
> E.G., something like this?
> (let loop ()
>      (cond [(send status-text locked-for-write?)
>             (fprintf (current-error-port) "waiting to try again.\n")
>             (sleep/yield 0.01)
>             (loop)]
>            [else (send status-text delete 0 (send status-text
> last-position))]))
> ... This seems to work, and it never seems to need to yield more than once,
> but I picked the sleep/yield number out of a hat, and it seems like polling
> is not the right solution here. Perhaps there's a way to queue a sequence of
> operations to be performed when the editor is no longer locked? Perhaps
> these locks are predictable, and there's a way to avoid the write lock in
> the first place?
> John
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.