Replacing those two printf() statements with write() did have
the effect of stopping those messages (even though i had to
replace one of them with a sprintf() and a strlen() in adsdition to the write())

But there are other printf() statements in both the main thread and
the created thread which don't seem to bother DRD...

Jody

On Thu, Jan 29, 2009 at 10:39 AM, Rainer Gerhards <rgerha...@gmail.com> wrote:
> On Thu, Jan 29, 2009 at 9:58 AM, jody <jody....@gmail.com> wrote:
>> Hi
>> I tried out DRD, but even though i read the DRD manual,
>> i don't really understand the output (i used --tool=drd --var-info=yes -v)
>> I get many messages concerning the same line, a print statement
>> performed by the thread just before it exits the start func:
>> ==19067== Conflicting store by thread 2/2 at 0x0400c018 size 4
>
> As of my understanding, two threads try to write into the same memory
> location without proper synchronization in place.
>
> [snip]
>
> which I think has an easy explanation:
>
>> I should add that the line 127 is
>>        printf("Ended loop\n");fflush(stdout);
>> (i.e. no direct call of puts())
>
> The standard io library is not thread safe. It is never a good idea to
> use it when running multiple threads (though from time to time I tend
> to do it due to laziness during debugging, but so I learn each time it
> is laziness that generates more work ;)). So remove the printf call
> with a call to the system write call. That should cover you.
>>
> Rainer
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Valgrind-users mailing list
> Valgrind-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to