Hi. I am asyncrhonously insert text strings to editor% (from another thread)
The problem is that i sometimes get this exception from object of editor% class: sequence-contract-violation: negative: method insert cannot be called, except in states (unlocked) I've tried to loop while editor is locked calling these functions http://docs.racket-lang.org/gui/editor___.html#%28meth._%28%28%28lib._mred%2Fmain..rkt%29._editor~3c~25~3e%29._locked-for-flow~3f%29%29 But it seems they do not work for me (do not return if editor is locked) and still that exception in caused. I've fallen back to ugly loop then. (define retry (call/cc (lambda (k) k))) (with-handlers ([exn:fail? (lambda (ex) (sleep 1) (retry retry))]) (send editor insert message)) Is there a better way? P.S Full source code for that stuff is available there: ------------------------------------------------------------------------------- https://github.com/lehitoskin/blight/blob/master/msg-history.rkt#L143 `add-recv-message' is called by `on-friend-message': https://github.com/lehitoskin/blight/blob/master/blight.rkt#L956 which is called back by `callback-friend-message' C function: https://github.com/lehitoskin/libtoxcore-racket/blob/master/functions.rkt#L489 ---------------------------------------------------------------------------------- Thank you. -- With best regards, Dmitry ____________________ Racket Users list: http://lists.racket-lang.org/users

