Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Mar 2005 00:29:39 +0000
From:      Jonathon McKitrick <jcm@FreeBSD-uk.eu.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Blocking on multiple threads with timeout
Message-ID:  <20050301002939.GA98056@dogma.freebsd-uk.eu.org>
In-Reply-To: <1109577414.4874.12.camel@localhost.localdomain>
References:  <20050227190842.GC34795@dogma.freebsd-uk.eu.org> <1109577414.4874.12.camel@localhost.localdomain>

next in thread | previous in thread | raw e-mail | index | archive | help

>>> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050301002939.GA98056>