GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Four — Flow Control (continued)
Overview
The WaitForObject function will wait for a specified object to be in a signaled state (ended) or until an optional time out occurs. This function can be used to synchronize multi-process and multi-thread programs and scripts.
Syntax/Parameters
Syntax
int = WaitForObject ( handle hObject, [int ms] );
Parameters
hObject
A handle to a compatible object.
ms
An optional int that specifies the amount of time in milliseconds to wait for the object. If no time is specified, the function will wait indefinitely. A value of 0 will test the object and quickly exit.
Return Value
Returns an int as ERROR_NONE on a successful signaled state or a formatted error code on failure. The lower portion of the formatted error code will contain a Windows error code or commonly WAIT_TIMEOUT (0x0102) if the time-out period has elapsed.
Remarks
This function can only be used with objects that support signaling, for example, processes created with the CreateProcess or RunBackgroundScript functions. Use of incompatible objects will result in an immediate return with ERROR_INVALID_HANDLE (6) ORed with ERROR_SOFT (0x80000000).
The WaitForObject function checks the current state of the specified object. If the object’s state is nonsignaled, the calling thread enters the wait state until the object becomes signaled or the time-out interval elapses.
The function modifies the state of some types of synchronization objects. Modification occurs only for the object whose signaled state caused the function to return. For example, the count of a semaphore object is decreased by one.
The WaitForObject function can wait for the following objects (only some objects can be directly created in Legato):
• Change notification
• Console input
• Event
• Memory resource notification
• Mutex
• Process
• Semaphore
• Thread
• Waitable timer
Use caution when calling the wait functions and code that directly or indirectly creates windows. If a thread creates any windows, it must process those windows’ messages. Message broadcasts are sent to all windows in the system. A thread that uses a wait function with a no time-out interval may cause the system to become deadlocked.
Use caution if the wait is run in the primary process thread since it will stop the application’s message loop and the application may appear unresponsive.
The ms value does not include time spent in low-power states. For example, the time-out will not keep counting down while the computer is asleep. See MSDN for more information.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.