Listing 4: test2.cpp Using the interlocked variable class
#include "interlok.hpp" // Counter static Interlock count; void Increment() { ++count; } // Increment void DecAndTest() { extern void DoSomething(void); if (--count==Interlock::Zero) { DoSomething(); } // if } // DecAndTest //End of File