this problem makes my head hurt...

From: Brian Denheyer <briand_at_inetarena.com>
Date: Fri, 30 Oct 1998 22:47:07 -0800 (PST)

I ran into the following situation and I can't think of a clean way to
get around it...

Let's say there is proc A. When procedure A is invoked, let's say by a
menu entry, proc A makes some new event bindings and then invokes a
tkwait.

Like this :

(define A
  (lambda ()
    (bind ...)
    (bind ...)
    (tkwait 'variable 'done)
    ;; cleanup...))

*however* activity at the top level continues. Let's say that some
other menu entry then causes proc B to be executed which does
something similar :

(define B
  (lambda ()
    (bind ...)
    (bind ...)
    (tkwait 'variable 'done)
    ;; cleanup...))

So now the problem. Porc A's bindings are still in effect. So, for
instance, if key-K was bound in proc A, and proc B is "executing",
control will return to proc A and the action bound there will be
invoked. What I realy want is for a change in "mode" to abort A.

One can then imagine that there are many routines like this, each of which should be aborted if another routine is invoked.

The best thing I have thought of so far is to make DONE a global
variable so that the top-level can set it's value causing porc A's
cleanup to be invoked. The problem is thatyou really want to know
that proc A has finished clean-up before invoking B. So now I am
thinking semaphore sorts of operations and it seems to me like this is
getting more complicated than it really should be.

Any suggestions...

Brian
Received on Sat Oct 31 1998 - 07:47:43 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST