I guess it's blocking because it keeps on running the "while" loop for
a long time. That's not the way to go. In fact, TCL is not multi
threaded, but event driven. So, the TCL/Tk interpreter has its own
loop (the event loop) to wait for things to happen. If you're waiting
for something to change in that loop, you don't allow the TCL
interpreter to get into the event loop. So, the command in the "after
10000 do_something" will probably never execute.

A better approach would be to check if the condition is true
periodically. Something like:

     ::MSN::changeStatus "NLN"
      a lot of things ...
      after 10000 do_something

      after 1000 check_timeout

proc do_something {} {
  ...
}

proc check_timeout {} {
     if {!SOMETHING} {
       a few things
       ::MSN::changeStatus "BSY"
       after 1000 check_timeout
    }
}


Or you could also take a look to "vwait" command. That should allow
tcl/tk to enter the event loop and continue running your code after
the specified variable has changed. But be careful, as it might
prevent other code from running and lead to deadlocks.

Greets.

2006/5/21, Salatiel Filho <[EMAIL PROTECTED]>:
i have added a new item on help menu , that calls one of my plugin's
methods.
But when i click it , amsn freezes until the plugin executes , that take a
little time , because i have at least 1  "after 10000"


My plugin method method is something like:

while  something [it will execute at most 3 times] {
     ::MSN::changeStatus "NLN"
      a lot of things ...
      after 10000
      a few things
      ::MSN::changeStatus "BSY"
}


any help ?





On 5/20/06, Youness Alaoui <[EMAIL PROTECTED]> wrote:
> after 10000 "command" should not block amsn and it should work for
> delaying the execution of the command.. see if the blocking is not because
> of something else (like a tkwait or something)
>
> KKRT
>
> On Sat, 20 May 2006 17:11:13 -0400, Salatiel Filho
> <[EMAIL PROTECTED]> wrote:
>
> > Hi ,  how can i delay the execution of one line of my plugin ?
> > I tried to use after 10000 COMMAND , but apparently this blocks amsn
> > entirely.
> > Is there another command that doesn't block amsn ?
> >
> >
>
>
>
> --
> KaKaRoTo
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Amsn-devel mailing list
> Amsn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amsn-devel
>



--
[]'s
Salatiel

"O maior prazer do inteligente é bancar o  idiota
   diante de um  idiota que banca o inteligente".


--
(:===========================================:)
 Alvaro J. Iradier Muro - [EMAIL PROTECTED]


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Amsn-devel mailing list
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel

Reply via email to