Doug Rabson wrote:
> > > All you have to do is create a situation where a shared object that links
> > > to libc_r is loaded after libX11 and the thing breaks into little pieces.
> >
> > So let's dike out libXThrStub.so, and be done with it.
> 
> I think the only stub which it defines that libc.so doesn't also define is
> pthread_cond_broadcast. I'm waiting to see if that lack causes any
> noticeable problems.

That's bizarre... it's defined in libc_r, so there's no reason for
the omission in libc.

Please find attached a patch that corrects this.

PS: It looks like the semaphore code use pthread_cond_signal; maybe it
should be using the pthread_cond_broadcast, instead?  This seeems to
be broken, if we are talking a large vs. small count on the semaphore...

-- Terry
Index: gen/_pthread_stubs.c
===================================================================
RCS file: /cvs/src/lib/libc/gen/_pthread_stubs.c,v
retrieving revision 1.7
diff -c -r1.7 _pthread_stubs.c
*** gen/_pthread_stubs.c        19 Sep 2002 01:09:49 -0000      1.7
--- gen/_pthread_stubs.c        30 Oct 2002 06:16:11 -0000
***************
*** 42,47 ****
--- 42,48 ----
   */
  __weak_reference(_pthread_cond_init_stub,     _pthread_cond_init);
  __weak_reference(_pthread_cond_signal_stub,   _pthread_cond_signal);
+ __weak_reference(_pthread_cond_broadcast_stub,        _pthread_cond_broadcast);
  __weak_reference(_pthread_cond_wait_stub,     _pthread_cond_wait);
  __weak_reference(_pthread_cond_destroy_stub,  _pthread_cond_destroy);
  __weak_reference(_pthread_getspecific_stub,   _pthread_getspecific);
***************
*** 82,87 ****
--- 83,94 ----
  
  int
  _pthread_cond_signal_stub(pthread_cond_t *cond)
+ {
+       return (0);
+ }
+ 
+ int
+ _pthread_cond_broadcast_stub(pthread_cond_t *cond)
  {
        return (0);
  }
Index: include/namespace.h
===================================================================
RCS file: /cvs/src/lib/libc/include/namespace.h,v
retrieving revision 1.9
diff -c -r1.9 namespace.h
*** include/namespace.h 29 Mar 2002 22:43:42 -0000      1.9
--- include/namespace.h 30 Oct 2002 06:17:39 -0000
***************
*** 77,82 ****
--- 77,83 ----
  #define               open                            _open
  #define               poll                            _poll
  #define               pthread_cond_signal             _pthread_cond_signal
+ #define               pthread_cond_broadcast          _pthread_cond_broadcast
  #define               pthread_cond_wait               _pthread_cond_wait
  #define               pthread_cond_init               _pthread_cond_init
  #define               pthread_exit                    _pthread_exit
Index: include/reentrant.h
===================================================================
RCS file: /cvs/src/lib/libc/include/reentrant.h,v
retrieving revision 1.1
diff -c -r1.1 reentrant.h
*** include/reentrant.h 19 Mar 2001 12:49:49 -0000      1.1
--- include/reentrant.h 30 Oct 2002 06:18:10 -0000
***************
*** 109,114 ****
--- 109,116 ----
  #define cond_init(c, a, p)    _pthread_cond_init(c, a)
  #define cond_signal(m)                if (__isthreaded) \
                                _pthread_cond_signal(m)
+ #define cond_broadcast(m)     if (__isthreaded) \
+                               _pthread_cond_broadcast(m)
  #define cond_wait(c, m)               if (__isthreaded) \
                                _pthread_cond_wait(c, m)
  

Reply via email to