Blocking on multiple threads with timeout

Jonathon McKitrick jcm at FreeBSD-uk.eu.org
Tue Mar 1 00:29:44 GMT 2005


>>> I'd like to start the init threads, put the id's in an array, block until
>>> they are all done, then continue.  Each thread should have its own
>>> timeout
>>> handling internally.

>It seems to me that you are complicating the issue for no
>good reason. Why are you using threads at all?

1.  We want to be able to easily cancel initialization before it finishes.
2.  The UI still needs to be responsive.
3.  By running initialization on threads, rather than serially, the total
initialization time is reduced.  Otherwise, we would have to init, wait,
then move to the next device.  With threads, we spawn a thread for each
device to send the command and wait for it, then wait for all the threads to
finish.  This way, total initialization will be only as long as the longest
init, rather than the sum of all the times.

Jonathon McKitrick
--
My other computer is your Windows box.


More information about the freebsd-questions mailing list