[uClibc 0001391]: pthread_cond_wait() does not block thread

bugs at busybox.net bugs at busybox.net
Wed Jun 13 16:41:31 UTC 2007


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1391 
====================================================================== 
Reported By:                jovicv
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   1391
Category:                   Posix Threads
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             06-13-2007 09:00 PDT
Last Modified:              06-13-2007 09:41 PDT
====================================================================== 
Summary:                    pthread_cond_wait() does not block thread
Description: 
I am using pthread_cond_t variables, pthread_cond_signal() and
pthread_cond_wait() to block a thread execution. The problem is that
pthread_cond_wait() does not block the thread execution.

On my host this program works fine with glib 4.2, but not with uclibc
0.9.28.3 on my target (i386).

Here is the output with pthread debugging information:
# ./test
02563 : __pthread_initialize_manager: manager stack: size=8160,
bos=0x80648e0, tos=0x80668c0
02563 : __pthread_initialize_manager: send REQ_DEBUG to manager thread
02563 : pthread_create: write REQ_CREATE to manager thread
02563 : pthread_create: before suspend(self)
02564 : __pthread_manager: before poll
02564 : __pthread_manager: after poll
02564 : __pthread_manager: before __libc_read
02564 : __pthread_manager: after __libc_read, n=148
02564 : __pthread_manager: got REQ_CREATE
02564 : pthread_handle_create: cloning new_thread = 0xbf7ffe20
02564 : pthread_handle_create: new thread pid = 2565
02564 : __pthread_manager: restarting -1209801248
02563 : pthread_create: after suspend(self)
02564 : __pthread_manager: before poll
02565 : pthread_start_thread:
got req msg http://busybox.net/bugs/view.php?id=0
startEthernetSend()
sending
02564 : __pthread_manager: after poll
02564 : pthread_reap_children:
Segmentation fault
#

In my program I have two threads:
1) In the 1st thread, I have:
std::cout<<"startEthernetSend()"<<std::endl;
pthread_mutex_lock(&newFrameMutex);
pthread_cond_wait(&canSend,&newFrameMutex);
pthread_mutex_unlock(&newFrameMutex);
std::cout << "sending" << std::endl;

2) In the 2nd thread I have this:
std::cout<<"found 1 frame in HW"<<std::endl;
pthread_mutex_lock(&newFrameMutex);
pthread_cond_signal(&canSend);
pthread_mutex_unlock(&newFrameMutex);

3) Mutex and cond variable are default initialized:
pthread_mutex_t newFrameMutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t canSend = PTHREAD_COND_INITIALIZER;

As I already said, this program works fine on the host, but not on the
target. Therefore, I have been wondering if anyone else is experiencing
same problems as I am with pthread_cond_wait() and pthread_cond_signal()
functions.
Do I have to do something to enable this functionality in uClibc?

====================================================================== 

---------------------------------------------------------------------- 
 jovicv - 06-13-07 09:41  
---------------------------------------------------------------------- 
I attached a test example, which is doing exactly what I am doing, and it
is performing correctly.

So, is there anything else that I take a look?
Maybe a combination of socket / uClibc pthreads?

Thanks in advance 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-13-07 09:00  jovicv         New Issue                                    
06-13-07 09:00  jovicv         Status                   new => assigned     
06-13-07 09:00  jovicv         Assigned To               => uClibc          
06-13-07 09:41  jovicv         Note Added: 0002481                          
======================================================================




More information about the uClibc-cvs mailing list