Thread Pool Problems

I’m seeing indications that the dispatch_block() function is returning
multiple times, and causing multiple threads to be started, for the same
event. I’ve built a simple test program (<150 lines of C) that listens
on two sockets and starts a thread pool to process connections. The
function registered via select_attach() calls accept. If two
connections come in close together (I have a 24 line PERL script to do
this) I see an extra thread start to execute and call accept() — and
block. This upsets the thread pool’s notion of how many threads are
busy, and it quickly creates the maximum possible number of threads, all
but a few of which are REPLY-blocked doing accepts, even though the fact
that the function was called should guaranty that accept() won’t
block. Anybody have any idea what I might be doing wrong? I hesitate
to post that much code here, but if anyone is interested I’d be more
than happy to send them the code.

Murf

John A. Murphy <murf@perftech.com> wrote:

I’m seeing indications that the dispatch_block() function is returning
multiple times, and causing multiple threads to be started, for the same
event. I’ve built a simple test program (<150 lines of C) that listens
on two sockets and starts a thread pool to process connections. The
function registered via select_attach() calls accept. If two
connections come in close together (I have a 24 line PERL script to do
this) I see an extra thread start to execute and call accept() — and
block. This upsets the thread pool’s notion of how many threads are
busy, and it quickly creates the maximum possible number of threads, all
but a few of which are REPLY-blocked doing accepts, even though the fact
that the function was called should guaranty that accept() won’t
block. Anybody have any idea what I might be doing wrong? I hesitate
to post that much code here, but if anyone is interested I’d be more
than happy to send them the code.

You can send the code to me and/or post it here and I
(or someone else here) will take a look at it.

Thanks
Thomas

Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Core OS Technology Group
(613)-591-0931 http://www.qnx.com/