[182] in Coldmud discussion meeting

root meeting help first previous next last

suspend()

daemon@ATHENA.MIT.EDU (Sun Mar 27 01:43:14 1994 )

Date: Sat, 26 Mar 1994 23:38:21 -0600 (MDT)
From: the Lynx <BRANDON@cc.usu.edu>
To: coldstuff@MIT.EDU
X-Vms-To: COLDSTUFF

I was just thinking, even if we have no way of knowing what status our tick
count is at, it would be damn nice to have a suspend() which simply froze the
task for n seconds.  What i'm thinking in reference to is for intensive calls,
where you could slow down its load on the server.

Example: we have a grep method (admin only) which searches every object's
methods for wildcards and regular expressions.  When it is currently run it
slams the server, and even the machine running the server.  I've just adjusted
it again so that it probably wont ever run out of ticks (lots of sub method
calls), but if I could put a suspend() up in the top level of loops it would
help immensely.

The second effect i'd like to see, and the more I think about this it may be a
different builtin from suspend (so i'll call it something different for now),
is a pause().  What this function would be for is to stop the current process
and allow all sub processes/calls to continue to completion, and then to
continue (feh--ignore my ignorance of terminology).  An example for this is:

I had $sys.backup announce to everybody that a backup is about to occur. 
However, since it also ran text_dump() it would run the textdump to completion
first, then everybody would get the announcement (after the fact).  Code:

-=[ $sys.backup():
args who;

.perms(sender(), 'system);
$channels.announce('all, "It is 12:30 pm, Impending backup, be ware of lag");
$sys.log("BACKUP: " + $eng_time.ltime() + " " + who.name('id));
.do_backup();
.
-=[ $sys.do_backup():
.perms(sender(), 'system);
return text_dump();
.

To get over this hurdle I had to pass the call to do_backup through the
$scheduler.  I dont know if this makes any sense.  Here is some more random
code:

-=[ $sys.backup():
args who;

.perms(sender(), 'system);
$channels.announce('all, "It is 12:30 pm, Impending backup, be ware of lag");
$sys.log("BACKUP: " + $eng_time.ltime() + " " + who.name('id));
pause();
.do_backup();
.

Where you toss the pause() in there.  You could even specify seconds that it
would pause, where if it finished sub calls before the allotted time was up it
would still wait, but if the alloted time was over before it finished sub calls
it would still be paused until it finished all sub calls...

(sigh)

Any comments?  This is a rambling post btw, and I appologize.

-Brandon (the Lynx)