help : mutex sharing between processes

vibi vibi_sreenivasan at cms.com
Sun Mar 9 09:22:35 UTC 2008


hello,
	thanks for your support.
	i was checking whether sharing mutex between process is
implemented.this is the code i used to test the same.

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

int main (void)
{
	pthread_mutexattr_t psharedm;
	if (pthread_mutexattr_init (&psharedm)) {
		printf ("error initializing mutex attribute\n");
		fflush (stdout);
		exit (EXIT_FAILURE);
	} 
        if (pthread_mutexattr_setpshared 
			(&psharedm,PTHREAD_PROCESS_SHARED)) {
		printf ("error setting shared attribute for mutex \n");
		fflush (stdout);
		pthread_mutexattr_destroy (&psharedm);
		exit (EXIT_FAILURE);
	}
}

for compiling in pc i used 
gcc -o <name of executable> <name of the c file> -lpthread

for cross-compiling i used
arm-linux-gcc -o <name of executabel> <name of c file> -lpthread

while i executed this in pc , it did not give any error message
but when i executed in target h/w i got 
"error setting shared attribute for mutex"

i doubt whether sharing of mutex between process is implemented for 
this version of uClibc.

thanks & regards
vibi sreenivasan

 
On Sat, 2008-03-08 at 17:51 +0100, Carmelo Amoroso wrote:
> vibi wrote:
> > hello,
> > 	i am trying to use sharing of mutex between processes on linux.
> > 	i am using functions pthread_mutexattr_init followed by
> > 	pthread_mutexattr_setpshared .
> > 
> > 	in pc (kernel = 2.6.22.1,libpthread-2.5.so) it is running ok.
> > 	but in arm-linux (kernel = 2.6.23.9, 
> > 			libuClibc-0.9.28.so,libpthread-0.9.28.so )
> > 	i am getting error for pthread_mutexattr_setpshared function.
> what kind of error ? this way nobody can't help you.
> Post a sample, command line used to compile, output, results showed at
> execution time... whatever... and also use gdb to debug your app too
> by your self.
> 
> Cheers,
> Carmelo
> > 	
> > 	is this function not implemented in uClibc , if not
> > 	where must i start from, so that i could contribute it back.
> > 	please help.
> > 	
> > 	thanks in advance 
> > 	
> > 	thanks & regards
> > 	vibi sreenivasan 
> > 
> > _______________________________________________
> > uClibc mailing list
> > uClibc at uclibc.org
> > http://busybox.net/cgi-bin/mailman/listinfo/uclibc
> > 
> 
> 




More information about the uClibc mailing list