[uClibc] Mutex and detached thread problem

Christian Magnusson christian.magnusson at runaware.com
Mon Jan 31 09:46:03 UTC 2005



I'm using the uClinux-dist-20041215 from
http://www.uclinux.org/pub/uClinux/dist/ with 2.4.27-uc1 kernel and
uClibc-0.9.26. The board I use is a MCF5206eC3.

Mutexes doesn't work at all if I don't have some calls to
pthread_mutexattr_settype()... used or not...
The strange thing is that mutex works if I the code looks like this:
------------------------------------------
pthread_mutex_t accept_mutex = PTHREAD_MUTEX_INITIALIZER ;
#define USE_MUTEX_ATTR

main() {
#ifdef USE_MUTEX_ATTR
  int set_mutexattr = 0;
  if(set_mutexattr) {
      pthread_mutexattr_t mattr;
      pthread_mutexattr_init(&mattr);
      pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_ADAPTIVE_NP);
      pthread_mutex_init(&accept_mutex, &mattr);
      pthread_mutexattr_destroy(&mattr);
  }
#endif
  /* accept_mutex works here, but ONLY when REMOVE_MUTEX_ATTR is set? */
}
------------------------------------------

I got some hints from Joakim Thernlund that it could be caused by
bugs with weak symbols or ld.so which is buggy in 0.9.26, but I
haven't been able to find the problem.

It looks like the constructor in libpthread/linuxthreads/pthread.c
static void pthread_initialize(void) __attribute__((constructor));
isn't called or something like that...

Please... Could anyone help me...

/Christian



On Fri, 2005-01-28 at 22:12 -0500, Mike Frysinger wrote:
> On Wednesday 26 January 2005 01:03 pm, Christian Magnusson wrote:
> > I don't know if the problem is caused by a bad compiler, buggy uClibc
> > or buggy kernel.
> 
> you didnt mention what version of uClibc but chances are you should probably 
> seek help from the uClinux peeps
> -mike
-- 
Christian Magnusson <christian.magnusson at runaware.com>




More information about the uClibc mailing list