BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001391 [uClibc] Posix Threads major always 06-13-07 09:00 06-13-07 09:41
Reporter jovicv View Status public  
Assigned To uClibc
Priority normal Resolution open  
Status assigned   Product Version 0.9.28.1
Summary 0001391: 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 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?
Additional Information
Attached Files

- Relationships

- Notes
(0002481)
jovicv
06-13-07 09:41
edited on: 06-14-07 00:10

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 should take a look?
Maybe a combination of socket / uClibc pthreads?

Thanks in advance

EDIT: I am using socket++ library, which uses select(). Could it be this is messing things up with pthread_cond_wait() ?

 

- 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
06-14-07 00:10 jovicv Note Edited: 0002481


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker