On Mon, 2009-03-30 at 10:57 -0400, Louis Savard wrote:

> I’m just starting out with valgrind. My application starts a bunch of
> threads in the main process. I’m seeing a couple issues when running
> the app through valgrind and haven’t been able to find answers in the
> help files.

> I’m investigating a problem at shutdown of my app. The main process is
> waiting on a semaphore that is unlocked by a signal. Valgrind doesn’t
> stop on the sem_wait. To go around this issue, I tried putting a delay
> using sleep() and nanosleep(). Valgrind doesn’t sleep at all when
> encountering the functions. This seems to be occurring only in the
> main process though. Other timers/delays in the spawned threads appear
> ok.

The sleep() syscall isn't guaranteed to sleep for the requested time,
even without the presence of Valgrind you shouldn't assume that because
it has returned the required amount of time has elapsed, rather wrap it
up in a loop measuring the elapsed time each iteration.

Ashley,


------------------------------------------------------------------------------
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to