On 24.10.2007, at 23:41, Stephen Deasey wrote: > But perhaps it could become something like this: > > > struct { > int enabled; /* default disabled */ > ... > } config; > > Ns_ModuleInit(char *server, char *module) > { > int def = 0; > > if (Cfg_GetBool("ns/foo", "enabled", &def, &config.enabled, > OnUpdate, &config) != NS_OK) { > return NS_ERROR; > } > } > > AtRuntime() > { > if (configEnabled) { > ... > } > } > > OnUpdate(char *section, char *key, CFG_TYPE type, *valuePtr, > void *arg) > { > int *enabledPtr = &((typeof(config) *) arg).enabled; > > *enabledPtr = *valuePtr; > } > > > (Obviously the details need work... :-)
Certainly. Because if I understood that correct, you would register a callback to modify some variable and that callback would be executed by some other thread (the one making the param change, right?). Yet, your thread minds his own bussiness and can (will) attempt to read the same variable perhaps at the same time the writer is going to change it. So where is the locking? I think this is not going to work this way, although it sounds very sexy. Or did I miss some important point? ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel