[ELDK] glibc change for eldk 3.1.1

Detlev Zundel dzu at denx.de
Fri Mar 26 14:54:06 CET 2010


Hi Levend,

> Hi,Detlev,
>
>> Ok, I'm getting lost here.  Threads are per definition defined on a
>> process basis.  pthread_mutex is also a construction which I fail to see
>> how to share it between processes.  Can you show me exactly what you
>> want to do here?
>
> I aggree with you. AFAIK, mutexes are in fact intra process
> primitives. But I dont understand why BerkeleyDB says these log lines
> although
> we have "pthread_mutex_init" function in our ELDK 3.1.1 toolchain.
>
> bdb(dc=karelarge,dc=com): unable to initialize mutex: Function not implemented
> bdb(dc=karelarge,dc=com): PANIC: Function not implemented
> bdb(dc=karelarge,dc=com): unable to join the environment

The first step here is to understand the problem.  I.e. find the source
code responsible for this message and find out why the code produces
this message.

> ------------------------------------------------------------------------------------------------------
>
>> Well interprocess synchronization is _per definition_ outside of threads
>> as the latter are defined on a process basis.  For interprocess
>> communication we have other primitives like SysV IPC, shared memory,
>> etc.
>
> Exactly, semaphores for example

Ok, so slowly we are establishing a common base, good.

>>Can you show me such a wording?  This would be news to me.
>
> BerkeleyDB source code has a comment like this :
>
> "Currently we support one kind of mutex that is intra-process only,
> POSIX 1003.1 pthreads, because a variety of systems don't support
> the full pthreads API, and our only alternative is test-and-set."
>
> So I thought there is something in the standart like inter process mutex.

Weird.  Again I looked at the mag page of "pthread_mutex_init" and I do
not see how one could use this to get to a mutex from another process.
The _only_ way I can think of is to initialize a mutex and then do a
fork() afterwards.  This way one would get multiple processes sharing
the address space.  However one fork documentation[1] says this:

  When a programmer is writing a multi-threaded program, the first
  described use of fork(), creating new threads in the same program, is
  provided by the pthread_create() function. The fork() function is thus
  used only to run new programs, and the effects of calling functions
  that require certain resources between the call to fork() and the call
  to an exec function are undefined.

So I doubt that this is legal use of pthread_mutexes.

>> I do not understand what you are doing here, sorry.
>
> I want to show you the alternatives for mutex implementation that
> BerkeleyDB can use. Maybe someone will say "You have to choose this
> one"

Ok, now that I reread this, I'm kind of surprised to find that ELDK
3.1.1 contains BerkeleyDB in version 4.0.14.  Did you try using that
instead of building your own?

Cheers
  Detlev

-- 
Man gelangt nicht dazu, gluecklich zu sein, aber man macht Feststellungen
ueber die Gruende, die uns daran hindern es zu sein.
                                                -- Marcel Proust
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the eldk mailing list