[xml] Thread safety (Exceeding TSD keys)
- From: "Jochen Kokemüller" <jochen kokemueller de>
- To: xml gnome org
- Subject: [xml] Thread safety (Exceeding TSD keys)
- Date: Sun, 13 Jun 2004 17:06:48 +0200
Hi,
I am expiriencing problems using the libxml2 library in a multithreaded
enwiroment. The problem is, that my application already uses a lot of
Thread specific data and the number of keys to address the thread
specific data is limited. The libxml2 library also seems to use a lot of
TSD but does not seem to bother wheter the thread specific data could be
acclaimed or not.
I my code i always wait as long as necessary until the data can be
stored safely, i do this for example by:
while (pthread_setspecific(mail_key, (..)))
{
usleep(1);
}
so later on the mail_key is guaranteed to be a valid key. This works
fine so far but when my app starts a bunch of threads each using the
libxml2 it segfaults in the libxml2 because of not valid keys and that
because of the fact that the max key number is already exceeded.
On my linux SuSE 9.0 System the PTHREAD_KEYS_MAX is 1024.
Am i doing anything wrong? Or is there a known workaround for this?
If not i would suggest the code stated above as a fix for this behaviour.
Regards,
Jochen Kokemüller
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]