From: Pierre-Alexandre V. <ont...@gm...> - 2013-01-10 14:18:10
|
I followed one of the simpler example (don't remember which one), in fact, my app starts with this code : let start handlers = let (option_list, cmdline_infos) = Netplex_main.args() in (* .... cut ... *) let nethttpd_factory = Nethttpd_plex.nethttpd_factory ~handlers:handlers () in Netplex_main.startup ( Netplex_mp.mp ~keep_fd_open:true () ) Netplex_log.logger_factories Netplex_workload.workload_manager_factories [ nethttpd_factory ] cmdline_infos Normally, only the threads will use the object. Because of my inability to user shared memory, I don't have any byte of global memory in this software (I use Memcache for that) So, if i start a thread and return the string result, is there a risk that the processes is killed by the master process before the thread finish his job (In theory not) ? 2013/1/10 Gerd Stolpmann <in...@ge...> > Am Donnerstag, den 10.01.2013, 13:19 +0100 schrieb Pierre-Alexandre > Voye: > > > > > Can I use a thread without risk ? > > Normally, yes, if you ensure that library functions do not "see" that > there are several threads, i.e. any object is only used by one thread at > a time. There are normally no mutexes controlling parallel access > built-in (except where described). There are also no global variables > making multi-threading impossible (and if so, there are mutexes around > them). > > I must admit that I do not exactly understand your architectural > problem. What I've got is that > > - You get a request via Nethttpd > - You call your service routine via the CGI-style interface > - that routine computes the result to return via CGI > - but that routine also needs to do some side work that is > not needed for the CGI return value, and could be run > outside the strict HTTP request/response cycle > > The answer to the question how you can run such side work depends very > much on how you deploy Nethttpd. Do you use the Netplex containers, or > did you follow one of the simpler examples? > > Gerd > > > > -- > ------------------------------------------------------------ > Gerd Stolpmann, Darmstadt, Germany ge...@ge... > Creator of GODI and camlcity.org. > Contact details: http://www.camlcity.org/contact.html > Company homepage: http://www.gerd-stolpmann.de > *** Searching for new projects! Need consulting for system > *** programming in Ocaml? Gerd Stolpmann can help you. > ------------------------------------------------------------ > > -- --------------------- https://twitter.com/#!/ontologiae/ http://linuxfr.org/users/montaigne |