В Wed, 8 Sep 2010 17:12:46 +0400
Konstantin Serebryany <[email protected]> пишет:

It still the same.

gcc ./main.cpp -o main -g -pthread -D_REENTRANT -D_THREAD_SAFE -lpthread

Regards,
 Ivan

==12972== Thread #1 is the program's root thread
==12972== 
==12972== Thread #2 was created
==12972==    at 0x41371F8: clone (in /lib/libc-2.12.1.so)
==12972==    by 0x4054425: pthread_create@@GLIBC_2.1 (in 
/lib/libpthread-2.12.1.so)
==12972==    by 0x40251E1: pthread_create_WRK (in 
/usr/lib/valgrind/vgpreload_helgrind-x86-linux.so)
==12972==    by 0x80484D9: main (main.cpp:84)
==12972== 
==12972== Possible data race during read of size 4 at 0xbecc119c by thread #1
==12972==    at 0x40251FD: pthread_create_WRK (in 
/usr/lib/valgrind/vgpreload_helgrind-x86-linux.so)
==12972==    by 0x80484D9: main (main.cpp:84)
==12972==  This conflicts with a previous write of size 4 by thread #2
==12972==    at 0x40252C9: mythread_wrapper (in 
/usr/lib/valgrind/vgpreload_helgrind-x86-linux.so)
==12972==    by 0x4053E5F: start_thread (in /lib/libpthread-2.12.1.so)
==12972==    by 0x413720D: clone (in /lib/libc-2.12.1.so)
==12972== 
tra-la-la


> On Wed, Sep 8, 2010 at 5:02 PM, Ivan S. Lyapunov <[email protected]>
> wrote:
> 
> > Hello.
> >
> >  I'm writed a simple pthreads program and can't understand Valgrind
> >  output because thre is no error in my case I think ;)
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <unistd.h>
> > #include <pthread.h>
> >
> > extern "C" {
> >
> >        void * run_handle(void * param) {
> >        printf("tra-la-la\n");
> >        return 0;
> >    }
> > }
> >
> > int main(int argc, char** argv) {
> >    pthread_t t;
> >    pthread_create(&t, 0, run_handle, 0);
> >
> >    sleep(10);
> >    return 0;
> > }
> >
> >
> > compile it
> > gcc ./main.cpp -o main -pthread -D_REENTRANT -D_THREAD_SAFE
> > -lpthread
> >
> 
> As the first step, try adding "-g" to the compile command.
> 
> --kcc
> 
>

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to