User Tools

Site Tools


mtsyncronization_object_interface_methods_summary.htm
Navigation:  Advanced Topics > Thread Model Documentation > Multi-Threading Programming >====== Synchronization Object Interface Methods Summary ====== Previous pageReturn to chapter overviewNext page

ICriticalSection.Wait( ) and IMutex.Wait( )

Implementation:

The first time either method is called, the calling thread gains control of the synchronization object. Any other threads that call Wait will wait until Release is called.

A thread can call Wait multiple times. Release() must be called once for each call to Wait.

ICriticalSection.Release( ) and IMutex.Release(count )

Implementation:

Each method decrements the counter of Wait calls. When the Wait count reaches zero, the synchronization object is released for any other thread to acquire control with a call to Wait.

Count specifies to release a given number of times up to the number of previously successful wait calls.

Kill( )

Implementation:

Releases all resources allocated when the target synchronization object was created with the appropriate NEW function.

ISemaphore.Wait( )

Implementation:

This method will wait until shared control of the synchronization object is allowed. Once this occurs, Wait will take partial control of the synchronization object.

A thread can call Wait( ) multiple times. Release( ) must be called once for each call to Wait.

ISemaphore.TryWait (ms) and IMutex.TryWait (ms)

TryWait PROCEDURE(LONG milliseconds),SIGNED,PROC

Implementation:

Attempts to gain control of the synchronization object within the ms parameter time in milliseconds. Return value is a signed EQUATE with one of the following results:

WAIT:OK

Control was acquired

WAIT:TIMEOUT

Control could not be acquired within the time limit

WAIT:NOHANDLE

Something is seriously wrong

WAIT:FAILED

Something else is seriously wrong

WAIT:ABANDONED

Another thread that had control of the synchronization object has ended without calling release. The caller now has the control the same way as if a WAIT:OK was returned. This is more of a warning indicating a flaw in the program logic.

ISemaphore.Release( )

Implementation:

Decrements the counter of Wait() calls. When the Wait() count reaches zero, the synchronization object is released for any other thread to acquire control with a call to Wait().

If more Release() calls are made than Wait() calls, the total number of threads allowed to control the semaphore is incremented up to the maximum parameter of NewSemaphore.

Count specifies to release a given number of times up to the number of previously successful wait calls.

ISemaphore.Handle( ) and IMutex.Handle( )

For internal use only

IReaderWriterLock.Reader( )

Purpose:

Returns a synchronization object that can be used to lock out writers. Any successful call to Reader.Wait() will stop any attempt at Writer.Wait() until Reader.Release() is called.

IReaderWriterLock.Writer( )

Purpose:

Returns a synchronization object that can be used to lock out any other writer and all readers. Any successful call to Writer.Wait() will stop any attempt at Writer.Wait() and Reader.Wait() until Writer.Release() is called

CriticalProcedure.Init (syncObj)

Purpose:

Calls syncObj.Wait(). syncObj.Release is called by the destructor.

mtsyncronization_object_interface_methods_summary.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1