[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns2] How can I stop the simulator?
``halt'' in scheduler.cc is not a Simulator class procedure.
I expect that your $ns is an object in the Simulator class.
You need the following wrapper to get "$ns halt" to work:
Index: tcl/lib/ns-lib.tcl
===================================================================
RCS file: /usr/src/mash/repository/vint/ns-2/tcl/lib/ns-lib.tcl,v
retrieving revision 1.45
diff -c -r1.45 ns-lib.tcl
*** ns-lib.tcl 1997/08/12 23:21:56 1.45
--- ns-lib.tcl 1997/08/26 18:06:47
***************
*** 180,185 ****
--- 180,190 ----
return [$scheduler_ run]
}
+ Simulator instproc halt {} {
+ $self instvar scheduler_
+ $scheduler_ halt
+ }
+
Simulator set NumberInterfaces_ 0
Simulator instproc simplex-link { n1 n2 bw delay arg } {
You should apply this using "patch -p" from the top-level ns-2 directory.
Kannan
>>> From: "Christoph Haenle" <[email protected]>
>>> Date: Tue, 26 Aug 1997 12:08:41 EDT
> Hi everybody,
>
> I need a means to stop the simulator even though there are still events
> scheduled. I want the simulator to RETURN from the command "$ns run" rather
> than having a callback-function like "finish" launched. In my case it would
> be perfectly fine to do a "$ns halt" from within a callback-function, and
> expected the simulator to terminate after the callback-function returns.
> But "halt" is not a documented feature and it doesn't work for me ("Unable
> to dispatch method halt").
>
> Any suggestions?
>
> TX,
>
> -Chris.