This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
About __gthread_active_p()
- From: Dhruv Matani <dhruvbird at gmx dot net>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Cc: Loren James Rittle <rittle at labs dot mot dot com>
- Date: 13 Apr 2004 23:41:32 +0530
- Subject: About __gthread_active_p()
- Organization:
Hello,
Ok, I have here a problem. Consider the test-suite file map_mt_find.cc
in the performance folder. Now, this needs to be compiled with -lpthread
for correct linking. This would mean that the mutex protection in all
the allocators that use __gthread_active_p() will get activated at
run-time. However, if you observe, then the insertion code for the
map/multimap is a single-threaded one. Only the find operation is
multi-threaded, because you can not concurrently insert into a
map/multimap, since they are not thread-safe. So, this unnecessarily
causes an overhead at run-time. How can this be avoided? Is there any
way of signaling that even if the .exe file / binary contains
pthread_create(), then the allocators are supposed to work as if it is a
single threaded app., because not the containers/allocators but other
code will need to work concurrently.
--
-Dhruv Matani.
http://www.geocities.com/dhruvbird/
Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html