2-136
SOMobjects Base Toolkit: Programmer’s Reference Manual
execute_request_loop Method
Purpose
Receives a request message, executes the request, and returns the result to the calling
client.
IDL Syntax
ORBStatus execute_request_loop (
in Flags waitFlag);
Description
The execute_request_loop method initiates a loop that waits for a request message,
executes the request, and returns the result to the client who invoked the request. When
called with the SOMD_WAIT flag, this method loops infinitely (or until an error). When called
with the SOMD_NO_WAIT flag, this method loops as long as it finds a request message to
process.
The SOMD_NO_WAIT flag is useful when writing event-driven applications where there are
event sources other than DSOM requests (for example, user input). In this case, DSOM
cannot be given exclusive control. Instead, a DSOM event handler can be written using the
SOMD_NO_WAIT option, to process all pending requests before returning control to the
event manager.
If the server’s ImplementationDef indicates the server is multi-threaded (the impl_flags
has the IMPLDEF_MULTI_THREAD flag set), each request will be run by SOMOA in a
separate thread (OS/2 only).
Parameters
receiver A pointer to the SOMOA object managing the implementation.
env A pointer to the Environment structure for the method caller.
waitFlag A Flags bitmask (unsigned long) indicating whether the method should
block (SOMD_WAIT) or return to the caller (SOMD_NO_WAIT) when there
is no request message pending.
Return Value
The execute_request_loop method may return an OBJ_ADAPTER exception which
contains an DSOM error code for the operation. SOMDERROR_NoMessages is returned as
an ORBStatus code if the method is invoked with SOMD_NO_WAIT and no message is
pending.
Example
#include <somd.h>
/* server initialization code ... */
...
_impl_is_ready(SOMD_SOMOAObject, &ev, SOMD_ImplDefObject);
/* turn control over to SOMOA */
(void) _execute_request_loop(SOMD_SOMOAObject, &ev, SOMD_WAIT);
Original Class
SOMOA
Komentarze do niniejszej Instrukcji