//*************************************************************** // From the book "Win32 System Services: The Heart of Windows 98 // and Windows 2000" // by Marshall Brain // Published by Prentice Hall // // Copyright 1995, by Prentice Hall. // // This code demonstrates the use of a semaphore to // synchronize threads. //*************************************************************** // sema.cpp #include #include #include volatile INT count; HANDLE semaphore; void CountThread(INT iterations) { INT i; INT x; LONG semaCount; for (i=0; i