Thanks to Mark, David, Robert, Russ, and anyone I forgot on this issue.
The solution was that we need to initialize our pthread_mutex_lock objects
in solaris 2.6.
Solaris 2.5 was more forgiving of this, but 2.6 is not as forgiving.
thanks again to the list,
my original post follows:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++
Hi,
I have a simple threaded program (this is a slice of a much larger program)
that works on my Sun 2.5.1 system, but hangs on my Sun 2.6 system...
It Works just fine on this box:
Release: 5.5.1
Kernel architecture: sun4u
Application architecture: sparc
Hardware provider: Sun_Microsystems
Kernel version: SunOS 5.5.1 Generic 103640-32 November 1999
Patched through 108658-02
It Doesn't work on this box:
Release: 5.6
Kernel architecture: sun4u
Application architecture: sparc
Hardware provider: Sun_Microsystems
Kernel version: SunOS 5.6 Generic 105181-20 January 2000
Patched through 109339-01
Both boxes are running this compiler...
CC: WorkShop Compilers 4.2 16 Jun 1998 C++ 4.2 patch 104631-07
tdb_link: WorkShop Compilers 4.2 16 Jun 1998 C++ 4.2 patch 104631-07
CC: WorkShop Compilers 4.2 16 Jun 1998 C++ 4.2 patch 104631-07
/opt/SUNWspro/bin/../SC4.2/bin/c++filt: WorkShop Compilers 4.2 16 Jun 1998
ild: WorkShop Compilers 4.2 15 Oct 1996 ILD 2.0
If there aren't any problems that jump out right away,
then here is the code itself:
The program will hang on my Sun 2.6 box in the runThread function while
trying to invoke the pthread_mutex_lock function. I'm sure some of you may
wonder what that set function is all about, all I know is that it needs
to be there.
=========================================================================
#include <pthread.h>
void runThread(void);
void set(pthread_mutex_t& rMutex);
pthread_mutex_t* pMutex;
int main(void)
{
pthread_mutex_t mutex;
pthread_t thread;
set(mutex);
pthread_create(&thread, NULL, (void*(*)(void*))runThread, NULL);
pthread_join(thread, NULL);
return 1;
}
void set(pthread_mutex_t& rMutex)
{
pMutex = &rMutex;
}
void runThread(void)
{
pthread_mutex_lock(pMutex); // Program hangs here waiting for a
// lock that it never obtains
pthread_mutex_unlock(pMutex);
}
===========================================================================
Any ideas?
thanks,
Rich
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:09 CDT