|
From: Konstantin S. <kon...@gm...> - 2009-03-04 11:52:37
|
On Tue, Mar 3, 2009 at 3:29 PM, Pınar Tözün <pin...@gm...> wrote:
> Hi,
>
> I am trying to implement the dynamic race detection algorithm
> "Goldilocks" into Helgrind but I am having some difficulties with the
> source code. The below c code is from the Valgrind Manual,
>
> #include <pthread.h>
>
> int var = 0;
>
> void* child_fn ( void* arg ) {
> var++; /* Unprotected relative to parent */ /* this is line 6 */
> return NULL;
> }
>
> int main ( void ) {
> pthread_t child;
> pthread_create(&child, NULL, child_fn, NULL);
> var++; /* Unprotected relative to child */ /* this is line 13 */
> pthread_join(child, NULL);
> return 0;
> }
>
> My question is; how can I understand when hg_handle_client_request is
> called and entered one of the LOCK cases, that it is not for the
> Helgrind's own locking procedures but it is for one of the locks in
> the checked c code. Because for the above example c code, although
> there is no locking for the variable 'var' it calls a lot of
> hg_handle_client_request with one of the LOCK cases in the switch
> statement.
Not sure I understood your problem.
Do you see LOCK/UNLOCK events when executing the program above?
There is probably some locking inside pthread_create...
--kcc
>
> Thank you!
> pinar
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
|