HP-UX SNAplus2 R7 LUA Programmer's Guide
Designing and Writing LUA Applications
LUA Entry Points for HP-UX Applications
happens, the verb returns synchronously; the primary return code is set to a value other than
LUA_IN_PROGRESS,
and the lua_flag2.async bit is set to 0 (zero). (For information about these returned parameters, see Chapter 4, RUI
Verbs or Chapter 5, SLI Verbs.)
At other times, LUA must wait for information from the remote LU or from the node before it can complete the
verb. In this case, the verb returns asynchronously; the primary return code is set to
LUA_IN_PROGRESS, and the
lua_flag2.async bit is set to 1. The application can now perform other processing, or wait for notification from
LUA that the verb has completed. LUA issues this notification by setting the primary return code to its final value,
leaving lua_flag2.async set to 1.
As part of the supplied VCB, the application supplies a pointer to a callback routine (in the
lua_post_handle
parameter). If the verb completes synchronously, LUA does not call the callback routine. If the verb completes
asynchronously, LUA indicates the verb completion by calling the callback routine with one parameter—a pointer to
the original verb control block (VCB). For more information, see Section 2.1.6, Callback Routine for Asynchronous
Verb Completion.
Notes
1. It is not possible for an application to predict whether a particular verb will complete
synchronously or asynchronously.
2. If the lua_flag2.async parameter indicates that the verb will complete asynchronously,
the program’s main thread of execution should not access any other parameters in the
VCB at this point. When LUA calls the callback routine, the application can then access
the VCB parameters.
3. Because of the way HP-UX callback routines operate, it is possible that the application’s
callback routine will be called before control returns to the application from its initial
function call for the verb. This means that, if the callback routine modifies or deletes
the returned VCB, the program’s main thread of execution may be unable to check the
VCB parameters to determine that the verb is operating asynchronously. You may need
to take account of this in your application design.
2.1.6 Callback Routine for Asynchronous Verb Completion
To enable an LUA verb to complete asynchronously, the application must supply a pointer to a callback routine.
This section describes how SNAplus2 uses this routine, and the functions that it must perform.
Function Call
void callback (verb)
LUA_VERB_RECORD * verb;
{.
.
}
Supplied Parameters
SNAplus2 calls the routine with the following parameter:
verb
Pointer to the VCB supplied by the application, including the returned parameters set by SNAplus2. The
callback routine may perform all the necessary processing on the returned parameters in the VCB, or may
simply set a variable to inform the main program that the verb has completed.
26