17 Mar 2009 13:56
Non Portable pthread (-np) API for thread creation in suspend mode
Srinivas G. <srinivasg <at> esntechnologies.co.in>
2009-03-17 12:56:18 GMT
2009-03-17 12:56:18 GMT
Dear All, I have implemented a threading program using the pthread library on CentOS - 5.2 Linux system. (The CentOS is an Enterprise Linux distribution based on the freely available sources from Red Hat Enterprise Linux.) However, I need to create a pthread that is initially suspended. But, I did not find any API in the pthread library which does the my requirement. So, I googled and found some of the FreeBSD thread API which is as follows. pthread_attr_setcreatesuspend_np pthread_suspend_np pthread_resume_np pthread_attr_setcreatesuspend_np - prepare attribute for creation of suspended thread. I have also seen that the "_np" stands for "non portable" API. (The functions with the pthread_ prefix and _np suffix are not portable extensions to POSIX threads.) My question is, how can I use the "_np" API on my Linux box. I guess, the "_np" API is available in "libthr" shared library. So, I tried to download the "libthr" shared library, but there is no luck to me. I have also one more question, Shall I use the "libthr" shared library on my CENTOS without affecting the "libpthread" library. If possible, please suggest me. I can also able to implement the suspend and resume functionality with the following mechanism. But I have also seen that with "libthr" we get better performance than "libpthread". Please look at the following link. That is the reason, I want to use the "libthr" on my CENTOS Linux box. http://www.dslreports.com/forum/r19082719-FreeBSD-libthr-libpthread static int ready_to_go = 0; static pthread_mutex_t suspend_mutex = PTHREAD_MUTEX_INITIALIZER;(Continue reading)
RSS Feed