On Tue, Jan 13, 2009 at 05:46:08PM +0000, Daniel P. Berrange wrote: > @@ -1948,6 +2000,26 @@ static int qemudRunLoop(struct qemud_ser > } > } > > + /* If number of active workers exceeds both the min_workers > + * threshold and the number of clients, then kill some > + * off */ > + for (i = 0 ; (i < server->nworkers && > + server->nactiveworkers > server->nclients && > + server->nactiveworkers > min_workers) ; i++) { > + > + if (server->workers[i].active && > + !server->workers[i].processing) { > + server->workers[i].quit = 1; > + > + virCondBroadcast(&server->job); > + virMutexUnlock(&server->lock); > + pthread_join(server->workers[i].thread, NULL); > + virMutexLock(&server->lock); > + server->workers[i].active = 0; > + server->nactiveworkers--; > + } > + } > + Doesn't this cause the main loop to hang -- eg. if we happen to try to kill of a worker which is doing some lengthy operation? > +struct qemud_worker { > + pthread_t thread; > + int active :1; > + int processing :1; > + int quit : 1; I guess maybe I'm unclear about the meaning of these flags. What's the difference between active & processing? Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 68 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list