Hi all,
I am new to linux and got problem with pthread_mutex_trylock(). I have used mutex in my code. When I try to call pthread_mutex_trylock() on RECURSIVE type of mutex it overwrites adjacent memory location (that is global variable of type structure say x, memory allocated using malloc()).
Actually I put 'awatch' hardware watch on variable x, when i call pthread_mutex_trylock() it changes variable 2 members of x with message like
0x 0xSomeAdd from libpthread.so.0
and that causes segmentation fault in later part of code...Is it any known issue with pthread?? if you want I can paste complete code here...I have searched enough on libpthread but couldnt find anything specific....
Configurations are
CentOs 5 on VM Workstation
>uname -a
Linux SamCentOs.itpl 2.6.18-128.1.6.el5 #1 SMP Wed Apr 1 09:19:18 EDT 2009 i686 i686 i386 GNU/Linux
>rpm -aq | grep libc
glibc-2.5-34
glibc-headers-2.5-34
glibc-common-2.5-34
glibc-devel-2.5-34
>rpm -aq | grep gcc
gcc-c++-4.1.2-44.el5
gcc-4.1.2-44.el5
libgcc-4.1.2-44.el5
gcc-gfortran-4.1.2-44.el5
and the strange thing is the code works fine with following configuration
Linux avSam 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 i686 i386 GNU/Linux
glibc-2.3.5-10
glibc-devel-2.3.5-10
glibc-common-2.3.5-10
glibc-headers-2.3.5-10
glibc-kernheaders-2.4-9.1.94
libgcc-4.0.0-8
gcc-4.0.0-8
gcc-c++-4.0.0-8
gcc-java-4.0.0-8
Thanks
LiveShell