Nathan,
So this is server wide control and monitoring. I'm wondering if it would be
possible to do something like an incr type control, where you could have a
loop and signal it to run once, or some number of times, and then pause.
(Oh, wait, maybe the eval subcommand runs the script once?) So I guess I
should ask if there is a way to begin a loop in a paused state?
On the examples: it seems like you would have to be pretty lucky to catch a
loop executing, this must be for finding loops which are misbehaving and
getting out of them without restarting the server.
It would also be nice if the info subcommand provided the number of spins or
loop iterations already performed. This might allow some form of automatic
detection and canceling of loops gone wild.
Anyway, pretty interesting code.
tom jackson
On Monday 05 June 2006 08:11, Nathan Folkman wrote:
> In AOLserver 4.5 the following new Tcl APIs are provided:
>
> "ns_for"
> "ns_foreach"
> "ns_while"
> "ns_loop_ctl"
>
> The usage is exactly the same as the "nsloopctl" module I checked in,
> and which I documented in the README file. The only difference between
> the two is that "nsloopctl" will actually "redefine" Tcl's "for",
> "foreach", and "while" commands, while the new AOLserver 4.5 APIs
> require you to use the new commands explicitly. Forgot we had added it
> to the core, so I'll remove - sorry about the confusion. ;-)
>
> Here's a quick example:
>
> server1:nscp 4> ns_thread begindetached "while 1 {ns_sleep 1:0}"
>
> server1:nscp 5> ns_loop_ctl list
>
> server1:nscp 6> ns_thread begindetached "ns_while 1 {ns_sleep 1:0}"
>
> server1:nscp 7> ns_loop_ctl list
> 0
>
> server1:nscp 8> ns_loop_ctl info 0
> 0 41973248 1149519792:592471 9 running {ns_while 1 {ns_sleep 1:0}}
>
> server1:nscp 9> ns_loop_ctl pause 0
> 1
>
> server1:nscp 10> ns_loop_ctl resume 0
> 1
>
> server1:nscp 11> ns_loop_ctl cancel 0
> 1
>
> server1:nscp 12> ns_loop_ctl list
>
> If you want to gather statistics about existing "for", "foreach", and
> "while" loops, simply rename those commands and have them instead point
> to the new commands:
>
> for -> ns_for
> foreach -> ns_foreach
> while -> while
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]>
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.