ATEasy has a full set of synchronization objects. Synchronization objects are used to eliminate contention among threads for shared resources, and to force threads to do their work in a deterministic order. The following chart shows some of the important differences between the different synchronization objects ATEasy supports. Click on the links for details.
|
Synchronization Object |
Purpose |
Scope |
Comments |
|
Resource protection via mutual exclusion |
Across processes |
Use when you need to protect resources across processes -- for example, to grant exclusive access to resources in a DLL (or local COM component) shared by different apps. |
|
|
Resource protection via mutual exclusion. |
Within a process |
Usually the simplest, most efficient way of protecting resources from simultaneous access attempts. Lowest-overhead mutual exclusion mechanism. The CriticalSection.lock method does not have a timeout parameter, so it should only be used for situations where the protected resource will be released in a fairly short time. |
|
|
Resource protection via "metered" access. Often used to limit access to a small set of system resources for performance or other purposes. |
Across processes |
Keeps a count of the number of threads with a lock on a resource and refuses additional locks once the specified limit is reached. |
|
|
Wake-up call to a thread waiting for work to be completed or new input to process. |
Across processes. |
Examples include error-logging and processing input from distributed sources. |
Note: For Mutex, Semaphore, and Event: Normally you use a large timeout value. When the synchronization object times out, that represents an error condition. A timeout value of zero allows the caller of Lock to take control of the resource if it is available, without blocking if it is not.