#include "ace/Synch.h" #include int main (int argc, char** argv) { ACE_Time_Value AceTimeOut; ACE_Manual_Event ePurgeThreadEvent; AceTimeOut.msec(2000) ; for (int i=0 ;i < 3; ++i ) { int j = ePurgeThreadEvent.wait (&AceTimeOut , 0); std::cout << "Event returned with status = " << j << std::endl ; } } Output when ran without valgrind ./a.out Event returned with status = -1 Event returned with status = -1 Event returned with status = -1 Output From Valgrind ====================== output on RHEL AS3.0 ========================== valgrind ./a.out ==7080== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux. ==7080== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward. ==7080== Using valgrind-2.0.0, a program supervision framework for x86-linux. ==7080== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward. ==7080== Estimated CPU clock rate is 2998 MHz ==7080== For more details, rerun with: -v ==7080== Event returned with status = 0 Event returned with status = 0 Event returned with status = 0 ==7080== ==7080== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ==7080== malloc/free: in use at exit: 13616 bytes in 15 blocks. ==7080== malloc/free: 47 allocs, 32 frees, 16184 bytes allocated. ==7080== For a detailed leak analysis, rerun with: --leak-check=yes ==7080== For counts of detected errors, rerun with: -v output on Redhat 9.0 ============================ valgrind --num-callers=20 -v ./a.out ==21403== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux. ==21403== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward. ==21403== Using valgrind-2.0.0, a program supervision framework for x86-linux. ==21403== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward. ==21403== Command line: ==21403== ./a.out ==21403== Startup, with flags: ==21403== --suppressions=/usr/local/lib/valgrind/default.supp ==21403== -v ==21403== --num-callers=20 ==21403== Reading syms from /home/senga/testPrograms/a.out ==21403== Reading syms from /lib/ld-2.3.2.so ==21403== Reading syms from /usr/local/lib/valgrind/vgskin_memcheck.so ==21403== Reading syms from /usr/local/lib/valgrind/valgrind.so ==21403== Reading syms from /lib/libdl-2.3.2.so ==21403== object doesn't have any debug info ==21403== Reading syms from /home/mvenkite/testbuild/vob/ccm_sw/ThirdPartyLib/linux/lib/libACE.so.5.3.5 ==21403== Reading syms from /home/senga/vob/ccm_sw/ThirdPartyLib/linux/lib/libstlport_gcc.so ==21403== object doesn't have any debug info ==21403== Reading syms from /usr/lib/libstdc++.so.5.0.3 ==21403== object doesn't have a symbol table ==21403== object doesn't have any debug info ==21403== Reading syms from /lib/libm-2.3.2.so ==21403== Reading syms from /lib/libgcc_s-3.2.2-20030225.so.1 ==21403== object doesn't have a symbol table ==21403== object doesn't have any debug info ==21403== Reading syms from /lib/libc-2.3.2.so ==21403== Reading syms from /home/mvenkite/testbuild/vob/ccm_sw/ThirdPartyLib/linux/lib/libstlport_gcc.so ==21403== object doesn't have any debug info ==21403== Reading syms from /usr/local/lib/valgrind/libpthread.so ==21403== Reading syms from /lib/librt-2.3.2.so ==21403== object doesn't have any debug info ==21403== Reading suppressions file: /usr/local/lib/valgrind/default.supp ==21403== Estimated CPU clock rate is 2396 MHz ==21403== REPLACING libc(__GI___errno_location) with libpthread(__errno_location) ==21403== REPLACING libc(__GI___h_errno_location) with libpthread(__h_errno_location) ==21403== REPLACING libc(__GI___res_state) with libpthread(__res_state) ==21403== ==21403== TRANSLATE: 0x4058AB70 redirected to 0x4076FDC8 ==21403== pthread_cond_wait/timedwait: mutex is unlocked or is locked but not owned by thread ==21403== at 0x4076EF40: pthread_cond_timedwait (vg_libpthread.c:1129) ==21403== by 0x402D423E: ACE_OS::cond_timedwait(pthread_cond_t*, pthread_mutex_t*, ACE_Time_Value*) (OS.i:2283) ==21403== by 0x402D531D: ACE_OS::event_timedwait(ACE_event_t*, ACE_Time_Value*, int) (OS.i:4499) ==21403== by 0x4030C340: ACE_Event::wait(ACE_Time_Value const*, int) (Event.cpp:55) ==21403== by 0x80487FA: main (tmp4.cpp:12) ==21403== by 0x4058A8C6: __libc_start_main (in /lib/libc-2.3.2.so) ==21403== by 0x8048710: (within /home/senga/testPrograms/a.out) Wait ended -1 Wait ended -1 Wait ended -1 ==21403== TRANSLATE: 0x40668CE0 redirected to 0x4076FEAC ==21403== ==21403== ERROR SUMMARY: 3 errors from 1 contexts (suppressed: 0 from 0) ==21403== ==21403== 3 errors in context 1 of 1: ==21403== pthread_cond_wait/timedwait: mutex is unlocked or is locked but not owned by thread ==21403== at 0x4076EF40: pthread_cond_timedwait (vg_libpthread.c:1129) ==21403== by 0x402D423E: ACE_OS::cond_timedwait(pthread_cond_t*, pthread_mutex_t*, ACE_Time_Value*) (OS.i:2283) ==21403== by 0x402D531D: ACE_OS::event_timedwait(ACE_event_t*, ACE_Time_Value*, int) (OS.i:4499) ==21403== by 0x4030C340: ACE_Event::wait(ACE_Time_Value const*, int) (Event.cpp:55) ==21403== by 0x80487FA: main (tmp4.cpp:12) ==21403== by 0x4058A8C6: __libc_start_main (in /lib/libc-2.3.2.so) ==21403== by 0x8048710: (within /home/senga/testPrograms/a.out) ==21403== IN SUMMARY: 3 errors from 1 contexts (suppressed: 0 from 0) ==21403== ==21403== malloc/free: in use at exit: 13616 bytes in 15 blocks. ==21403== malloc/free: 47 allocs, 32 frees, 16184 bytes allocated. ==21403== --21403-- TT/TC: 0 tc sectors discarded. --21403-- 2580 chainings, 0 unchainings. --21403-- translate: new 8498 (116155 -> 1471786; ratio 126:10) --21403-- discard 0 (0 -> 0; ratio 0:10). --21403-- dispatch: 100000 jumps (bb entries), of which 24284 (24%) were unchained. --21403-- 4/8959 major/minor sched events. 8594 tt_fast misses. --21403-- reg-alloc: 575 t-req-spill, 267876+3022 orig+spill uis, 35297 total-reg-r. --21403-- sanity: 5 cheap, 1 expensive checks. --21403-- ccalls: 31226 C calls, 61% saves+restores avoided (113632 bytes) --21403-- 41366 args, avg 0.90 setup instrs each (8202 bytes) --21403-- 0% clear the stack (93678 bytes) --21403-- 8718 retvals, 37% of reg-reg movs avoided (6442 bytes)