From: Stephen D. <sd...@gm...> - 2005-10-21 05:42:30
|
On 10/20/05, Zoran Vasiljevic <zv...@ar...> wrote: > > Am 19.10.2005 um 18:16 schrieb Zoran Vasiljevic: > > > Hi ! > > > > We have a pretty elaborate (and sometimes confusing) mechanism > > for running various atXXX scripts. > > > > So, if I would like to: > > > > ns_atstartup X > > ns_atstartup Y > > ns_atstartup Z > > > > then the server will execute: > > > > Z > > Y > > X > > > > i.e. in the *reverse* order. This is because all of those > > are just entered in a single-linked list and the head of > > the list points always to the *last* registered item. > > > > This is suboptimal. > > > > In many real world scenarios, I will like to use the ns_atstartup > > to schedule couple of scripts to do various initialization things. > > It is often so that Y will depend on X and Z on Y to be successfull. > > At the moment, I'm (mis)using the ns_job with a single thread and > > post the jobs there, because it will then exectue them in FIFO fashion > > (which is what I need). BUT: this is of course not optimal as it runs > > parallely with the server startup and I have to be carefull to > > accomodate > > for that. > > > > So, I'm all for reversing the logic of script execution i.e. doing the > > more natural way of runing them in FIFO fashion (now we have LIFO). > > But, I'm afraid of the potential compatibility problems. What I would > > like to see is if any of you would have objections to reversing the > > logic, and if yes, ideas how we could make this compatible? > > One idea would be: > > > > ns_atXXX ?-tail? $theScript > > > > I'd rather go after FIFO list walk then adding yet-another-option, > > but I'm open to suggestions... > > I've done the coding. > > All ns_atXXX EXCEPT ns_atshutdown will now execute callbacks in FIFO > fashion. The ns_atshutdown will execute the callbacks in LIFO fashion. > This seems more natural to me. If nobody has anyhing against > (Vlad already expressed himself) I will commit this. FIFO makes sense to me. Thanks for the change. Not sure about LIFO for shutdown callbacks though. Does it make sense? It's one extra thing to remember... |