DispatchMSEvents

Dispatches message and signal events to their handler routines.

Synopsis

int32 DispatchMSEvents(MSEventHandle mseHandle, void *userContext,int32 reserved)

Description

Waits for events and dispatches processing to the event's handlers. Loops internally, waiting for messages and signals, dispatching the handlers when they are received, then looping back to wait again after the handlers return. As long as the handlers keep returning zero status, this function loops internally. As soon as a handler returns a non-zero value, this function returns that value to the caller.

By convention, a negative return value is an error. This may be an error returned by a handler function, or an error detected in waiting for and decoding an event. The latter should be very rare; the process of waiting for a message or signal, looking up the message, and so on, is relatively foolproof. If DeleteItem() is called on the message or port item, the function is likely to fail.

Arguments

mseHandle
MSEventHandle returned by SetupMSEvents().
userContext
Any value you want; it is passed to the handler functions as they are dispatched.
reserved
Reserved for future expansion; pass zero.

Return Value

Returns negative on error, or any non-zero status returned by your event handler routines.

Implementation

Library call implemented in lib3do.lib.

Associated Files

lib3do.lib, msgutils.h

See Also

SetupMSEvents