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

From: John Clements (clements at brinckerhoff.org)
Date: Wed Oct 7 15:25:47 EDT 2009

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20091007/c5216d28/attachment.p7s>

Posted on the users mailing list.