Results 1 to 6 of 6
I am crosscompiling a library for ARM processor running Linux. My host is
Intel x86 / Ubuntu. When I compile and run on my host machine,
everything works well. However, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-17-2009 #1Just Joined!
- Join Date
- Aug 2009
- Posts
- 5
pthread_mutex_lock segmentation FAULT
I am crosscompiling a library for ARM processor running Linux. My host is
Intel x86 / Ubuntu. When I compile and run on my host machine,
everything works well. However, when I compile, link and run an example
program on the target, it results in Segmentation Fault. In particular,
The library creates a FEW mutexes and has numerous operations to create, lock, release those mutexes. For a while, it works ok. Mutexes are created, locked and released on the traget. But after a point, suddely, it crashes with Segmentation Fault in the lock step :
pthread_mutex_lock(this=0x20005,hMutex=0x7500) //random numbers
Program Recd signal SIGSEGV
I am unable to reason out under what conditions this error may happen. Since the system is able to lock mutexes in many instances before. Plus, this error does not happen on Ubuntu but happens on the target device.
What can I do to debug this problem and find a solution, Please advice, VERY URGENT
- 08-21-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,142
Well, I don't know about your implementation of pthreads, but on my CentOS/RHEL system, the signature for pthread_mutex_lock is:
This isn't how you are apparently calling the function.Code:int pthread_mutex_lock(pthread_mutex_t *mutex);
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 08-21-2009 #3Just Joined!
- Join Date
- Aug 2009
- Posts
- 5
Thanks. the signature i used is correct. I was able to solve the problem. I tried a few cases and it worked. There was some problem in the function which was creating the mutex.
- 08-21-2009 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,142
So, why the difference in function signatures? Is this a "custom" pthread implementation? Posix thread libraries at the same major version level at least should all have the same API's. What version are you running?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-16-2010 #5Just Joined!
- Join Date
- Sep 2010
- Posts
- 1
Hi
I currently face the same problem. What did you do to solve it exactly?
I use the following code to create the mutex:
pthread_mutex_init(&semaphore_ptr->tx_mutex, NULL);
and the following to lock:
pthread_mutex_lock(&semaphore_ptr->tx_mutex);
where semaphore_ptr is a pointer to a struct.
- 09-16-2010 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,142
This is a very old thread. Please post your own and provide more details and code examples, especially where you are declaring and using your semaphore/mutex structures, etc.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!



