linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Bug in LinuxThreads?
@ 1999-04-01 15:18 Charles A. Jolley
  1999-04-01 18:57 ` Kevin B. Hendricks
  0 siblings, 1 reply; 2+ messages in thread
From: Charles A. Jolley @ 1999-04-01 15:18 UTC (permalink / raw)
  To: linuxppc-dev


Hi all:
    I apologize if this is too off topic, but I am trying to figure out
where to go in order to get this problem fixed and this listserv seemed to
be the best place.  A few days ago I posted the attached message below to
the comp.programming.threads newsgroup in relation to a problem I've been
having with running a piece of threaded code I've written on a standard R4
installation (running the 2.1.125) kernel.  The issue is described is detail
below.

    I have had a few responses back from people telling me they compiled the
included code on an Intel box and it worked fine.  This leads me to believe
there might be a bug in the pthreads or kernel (probably pthreads) code that
is causing the problem.  My question: is there an update that I have missed,
or whom do I need to contact to work on getting this thing fixed.  I don't
mind working on finding the bug myself, I'm just not even sure of where I
can find the pthreads source code for LinuxPPC!

Thanks,
-Charles

-------------------------------------------------ATTACHED MESSAGE--------

Hi,

I have been trying to write a program that involves a thread pool which,
over the course of the operation of the program, will create and exit
several threads.  I am finding that if I have exited any threads during
the program run, then it hangs upon exiting from main().  [Specifically,
GDB shows it hanging in the function pthread_exit_process(), which is
called automatically by the tear-down code, I presume.]

I can't figure out why it is doing this and if there is anything that I
need to do or if it is a bug in this version or what.  I am currently
running the 4.2 release of LinuxPPC (2.1.125 kernel, based on the 5.0
RedHat release) with lib6 and egcs (so when I use C++, this should not
be a problem) and I am doing the normal _REENTRANT/-lpthreads linking
thing.

I have included some code below that will cause the problem to occur
when compiled.  Any help is greatly appreciated.

Thanks,
-Charles

----
NON-FUNCTIONAL CODE
Compiled with "gcc -D_REENTRANT -s -o buggy1 buggy1.c -lpthreads"

--NOTE THE LINE TO UNCOMMENT THAT WILL MAKE THE PROGRAM "WORK"; i.e. it
will now exit normally, but this is obviously not a real fix.--

----

/* --- Messed up Threading Code Begins --- */

#include <pthread.h>
#include <stdio.h>

void *thread_routine(void *arg)
{
/*      while(1) ; //Uncomment this (so thread doesn't die) and proc
exits! */
        return (void*)3 ;
}

main ()
{
        pthread_t thread_id ;
        void *thread_result ;
        int status ;

        status = pthread_create(
                &thread_id, NULL, thread_routine, NULL) ;
        if (status!=0) {
                printf("Create Thread!\n") ;
                exit(1) ;
        }

        status = pthread_detach(thread_id) ;
        if (status!=0) {
                printf("Detach Thread!\n") ;
                exit(1) ;
        }

        sleep(1) ;
        return 1 ;
}

/* --- Messed up Thread Code Ends --- */

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug in LinuxThreads?
  1999-04-01 15:18 Bug in LinuxThreads? Charles A. Jolley
@ 1999-04-01 18:57 ` Kevin B. Hendricks
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin B. Hendricks @ 1999-04-01 18:57 UTC (permalink / raw)
  To: Charles A. Jolley; +Cc: linuxppc-dev


Hi,

I ran your test program under R4.1 and with the very latest glibc 1.99 rpm from
Gary Thomas and it worked fine. (exited properly)

By the way, your comment in the code about how to compile is wrong (it is
libpthread.so NOT libpthreads.so) so -lpthread no -lpthreads

I have made a few changes to linuxthreads to improve performance with the JDK
1.2 native threads.  Please try with Gary's latest glibc 1.99 rpm (which has
libpthread in it).  It that doesn't work, I will post my libpthread.so and
libpthread.a for you to try.

If only my version works for you, I will post the diffs for you and you can roll
your own.

I hope this helps.

Kevin

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-04-01 18:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-04-01 15:18 Bug in LinuxThreads? Charles A. Jolley
1999-04-01 18:57 ` Kevin B. Hendricks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).