Hi,
I think I either have found a bug in the threadpool library,
or I misunderstand it's use.
If you allocate a threadpool, but give it nothing to do
and free the thread pool again, threads keep hanging around.
Here's my test program:
#include <stdio.h>
#include <pthread.h>
#include <glib.h>
void dummy(gpointer data, gpointer user_data)
{
}
int main(int argc, char *argv[])
{
int count = 10;
GThreadPool *gtpool;
g_thread_init(NULL);
while (count--) {
printf("step %d\n", count);
gtpool = g_thread_pool_new(dummy, NULL, 4, TRUE, NULL);
g_thread_pool_free(gtpool, FALSE, TRUE);
sleep(5);
}
return(0);
}
I compiled it with:
cc -D_REENTRANT -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -o tt tt.c -lgthread-2.0 -lpthread -lglib-2.0
on a dual CPU redhat 7.2 machine.
If you do `ps fax ` from another terminal while this program
runs, you see the amount of threads growing.
This only happens if there are some unused threads.
I'm not into glib much, I gave it a short look, but had
to give up on it.
Regards,
Ron Arts
--
Netland Internet Services
bedrijfsmatige internetoplossingen
http://www.netland.nl Kruislaan 419 1098 VA Amsterdam
info: 020-5628282 servicedesk: 020-5628280 fax: 020-5628281
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature