I have the same issue with our own message queues.
Helgrind does not support them out of the box but can be easily enhanced.

I did it with the help of source code changes:

void Put(T elem) { // put() method of your queue
  sem_t *uniq_sem = new sem_t;
  sem_init(uniq_sem);
  sem_post(uniq_sem);
  // now do the actual 'put' stuff, putting uniq_sem together with elem
}

T Get() { // get() method of your queue
  // do the actual 'get' stuff; get uniq_sem from queue together with elem
  sem_wait(uniq_sem);
  sem_destroy(uniq_sem);
  delete uniq_sem;
  return elem;
}

The good thing is that you don't really need to create a real semaphore --
just create a integer with unique value (I use atomic_increment of static
var) and pass it to appropriate helgrind's user requests (see helgrind.h and
hg_intercepts.c).

The bad thing is that it might be challenging to achieve the same effect
without source code changes.
It is not enough to intercept the call to Put/Get routines -- you need to
put something into the queue (at least, I did not find another way).


--kcc



On Dec 17, 2007 10:23 PM, Sahni, Jitan <[EMAIL PROTECTED]>
wrote:

>
>  does helgrind work properly on ACE Tasks and Message Queues ?  I am
> getting some helgrind race alerts when using ACE Tasks and Message Queues.
> Basically the parent and child thread are created at start of the program
> and then parent passes buffer of data to child thru ACE Message Queue . the
> waiting child picks the data , uses it and frees it . helgrind is alerting
> me on race condition on this model . Does helgrind work correctly on this
> model of multi threads ( tasks and Queues ) ?
>
> Also is there any way to print memory contents of the location printed in
> a race condition ?
>
>
>
> ==============================================================================
> Please access the attached hyperlink for an important electronic 
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ==============================================================================
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
>
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Valgrind-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>
>
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Valgrind-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to