Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

I don't want much of nothin' at all...

But I will take another toke.

- Charlie Daniels

 

aztec.system.SyncFlag

public class SyncFlag from<Base>

Base

SyncFlag

The SyncFlag class provides a synchronization flag to control processing across multiple threads. When a thread calls WaitForAccess() for the synchronization flag, the thread waits until the state of the flag has been "raised" before continuing. This allows another thread to complete a specified activity before raising the flag. When the thread that was waiting for access to the flag continues, it can be assured that the operation which the other thread was performing is actually complete.

SyncFlag Methods

SyncFlag() Constructor for the SyncFlag class
CheckAccess() Checks to see if access is available
WaitForAccess() Pauses the thread until access to the synchronization flag is obtained
RaiseFlag() Sets the status of the sync flag to "raised", granting access to a waiting thread
ClearFlag() Clears the status of the sync flag

Derived Classes

See Also

 


SyncFlag()

public method SyncFlag(bool InitAccess = false)

Parameters

InitAccess

Gets access at creation time if true, in other words the "synchronization flag" is raised. False by default.

Return Value

None

Description

Constructor for the SyncFlag class. If the InitAccess flag is false, the thread which wait for access to the sync flag will wait until another thread "raises the flag".

 

SyncFlag Class


CheckAccess()

public virtual method<bool> CheckAccess()

Parameters

None

Return Value

Returns true if access to the resource is currently available, and false if not.

Description

Checks the current status of the synchronization flag. If is "raised", this method returns true. If the sync flag is not currently raised, then this method returns false.

 

SyncFlag Class


WaitForAccess()

public virtual method<bool> WaitForAccess(int TimeOut = 0)

Parameters

TimeOut

Value of timeout period in milliseconds. If access has not been obtained by that time, the call terminates. If the timeout period is set to zero, the timeout period is infinite.

Return Value

Returns true if access to the resource was obtained, and false if the call times out.

Description

Waits for the synchronization flag to be raised. If it is "raised" when the method is called, the call returns immediately with a return value of true, and the thread can continue its processing. If the sync flag is not raised. then the calling thread waits until another thread raises the sync flag. If the time out value is greater than zero, and access is not obtained in the specified time period, this method returns false.

 

The thread's execution status is still considered "running" while this method waits for the flag to be raised.

 

The status of the synchronization flag is automatically turned off once the calling thread is granted access.

 

SyncFlag Class


RaiseFlag()

public method RaiseFlag()

Parameters

None

Return Value

None

Description

Set the state of the synchronization flag to "raised". If another thread is waiting for access to this sync flag, it will be allowed to proceed. Once that thread gets access to the sync flag, and it continues execution, the state of the sync flag is automatically turned back off. If multiple threads are waiting for access to the thread, this "raise" operation will only release a single waiting thread.

 

SyncFlag Class


ClearFlag()

public method ClearFlag()

Parameters

None

Return Value

None

Description

Clears the state of the synchronization flag (removes the "raised" state). This call is normally not needed, since the system turns off the flag automatically when a thread gets access to the flag using "WaitForAccess()".

 

SyncFlag Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec