Ashley, I agree but why would the sleep only work in the spawned threads
and not the main process? I used the sleep to try to forego a problem
with the semaphores. Semaphores are used in the code to enforce
synchronization of the different threads. I don't think it works when
running the application through valgrind.


Konstantin, I'm launching valgrind through this command line:
[user]$ valgrind --log-file=memcheck.txt --leak-check=full -v
./myapp.bin

The main loop is the following:

{
   InitLayer1();
   InitLayer2();

   rv = sem_init(&main_thread_sem, 0, 0);
   assert(rv == 0);

   // Keep primary thread alive for sequenced shutdown
   rv = sem_wait(&main_thread_sem) ; // sem_post from TTY_STOP signal
   assert(rv == 0);

   rv = sem_destroy(&main_thread_sem);
   assert(rv == 0);

   // Reverse order from startup
   ShutdownLayer2();
   ShutdownLayer1();
}


If I leave the code as is, under valgrind, the sem_wait asserts. That's
why I was trying to put a delay there, just so I could reach have the
system start and shutdown properly.


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

Reply via email to