This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

About __gthread_active_p()


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]