Using Semaphores

Semaphores are an integer variable used to count in a synchronized way. Semaphores are often used to control access to a limited resource. For example, if your Windows CE device had two serial communications ports, you might use a semaphore to ensure that an application blocks if all communications ports are in use, and then un-blocks when one is freed. A semaphore object is signaled when less than the maximum number of resources is in use, and non-signaled when all the resources are in use. Semaphores were introduced in Windows CE 3.0. The following steps are used when using a semaphore:

  • The semaphore is created or opened using the CreateSemaphore function (Table 6.6). This function is passed the maximum number of available ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.