Index: openacs-4/packages/acs-core-docs/www/programming-with-aolserver.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/programming-with-aolserver.html,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-core-docs/www/programming-with-aolserver.html 28 Feb 2003 05:36:05 -0000 1.9 +++ openacs-4/packages/acs-core-docs/www/programming-with-aolserver.html 24 Jun 2003 03:58:11 -0000 1.10 @@ -1,10 +1,10 @@ -Programming with AOLserver

Programming with AOLserver

+Programming with AOLserver

Programming with AOLserver

by Michael Yoon, Jon Salz and Lars Pind.
- OpenACS docs are written by the named authors, but may be edited + OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff. -

The global command

+

The global command

When using AOLserver, remember that there are effectively two types of global namespace, not one:

  1. Server-global: As you'd expect, there is @@ -27,7 +27,7 @@ complicate) our use of script-global variables dramatically, which would then be better described as thread-global variables. Given AOLserver's behaviour, however, "script-global" is a more -appropriate term.

Threads and Scheduled Procedures

+appropriate term.

Threads and Scheduled Procedures

ns_schedule_proc and ad_schedule_proc each take a -thread flag to cause a scheduled procedure to run asychronously, in its own thread. It almost always seems like a good idea to @@ -40,11 +40,11 @@ time the task is executed - and it is a very expensive process that should not be taken lightly!

The moral: if you have a lightweight scheduled procedure which runs frequently, don't use the -thread -switch.

Note also that thread is initialized with a copy of what was +switch.

Note also that thread is initialized with a copy of what was installed during server startup, so if the procedure table have changed since -startup (e.g. using the APM watch +startup (e.g. using the APM watch facility), that will not be reflected in the scheduled -thread.

Using return

+thread.

Using return

The return command in Tcl returns control to the caller procedure. This definition allows nested procedures to work properly. However, this definition also means that nested procedures cannot use return to @@ -61,7 +61,7 @@ executed because the thread was not stopped. Note that return -code return can be used in circumstances where the procedure will only be called from two levels deep. -

Returning More Than One Value From a Function

+

Returning More Than One Value From a Function

Many functions have a single return value. For instance, empty_string_p returns a number: 1 or 0. Other functions need to return a composite value. For instance, consider a function that looks up a user's name and email @@ -113,11 +113,11 @@ arrays internally to build up some value, there are many entries in the array, and you're planning on iterating over the proc many times. In this case, pass-by-value is expensive, and you'd use pass-by-reference. -

The transformation of the array into a list and back to an +

The transformation of the array into a list and back to an array takes, in our test environment, approximately 10 microseconds per entry of 100 character's length. Thus you can process about 100 entries per milisecond. The time depends almost completely on the number of entries, and -almost not at all on the size of the entries.

+almost not at all on the size of the entries.

You implement pass-by-reference in Tcl by taking the name of an array as an argument and upvar it.

@@ -212,4 +212,4 @@
 perform lookup by name, they perform a linear lookup, whereas arrays use a
 hash table, so ns_sets are slower than arrays when the number of
 entries is large. 
-

($Id$)
View comments on this page at openacs.org
+

($Id$)
View comments on this page at openacs.org