Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

ISync Interface

Acquire/Release protocol, base of many concurrency utilities.

For a list of all members of this type, see ISync Members .

[Visual Basic]
Public Interface ISync
public interface ISync

Types that implement ISync

Type Description
Latch A latch is a boolean condition that is set at most once, ever. Once a single release is issued, all acquires will pass.

Sample usage. Here are a set of classes that use a latch as a start signal for a group of worker threads that are created and started beforehand, and then later enabled.

class Worker implements IRunnable { private readonly Latch startSignal; Worker(Latch l) { startSignal = l; } public void Run() { startSignal.acquire(); DoWork(); } void DoWork() { ... } } class Driver { // ... void Main() { Latch go = new Latch(); for (int i = 0; i < N; ++i) // make threads new Thread(new ThreadStart(new Worker(go)).Start(); DoSomethingElse(); // don't let run yet go.Release(); // let all threads proceed } }

Base class for counting semaphores based on Semaphore implementation from Doug Lea.

TimeoutSync A TimeoutSync is an adaptor class that transforms all calls to acquire to instead invoke attempt with a predetermined timeout value.


ISync objects isolate waiting and notification for particular logical states, resource availability, events, and the like that are shared across multiple threads.

Use of ISyncs sometimes (but by no means always) adds flexibility and efficiency compared to the use of plain .Net monitor methods and locking, and are sometimes (but by no means always) simpler to program with.

Used for implementation of a SimplePool


Namespace: Spring.Threading

Assembly: Spring.Core (in Spring.Core.dll)

See Also

ISync Members | Spring.Threading Namespace