NAME

coreThreadStop() -- request the dispatch thread to shutdown.


SYNOPSIS

include "appcore.h"

int coreThreadStop( corehTHR_t h )

DESCRIPTION

The coreThreadStop() function is used to stop a dispatch thread. This function sends the thread an exit message. If the function indicates success, the message was successfully appended to the thread's input queue. When the thread processes the message, it will exit. All messages ahead of the exit message on the thread's input queue are still processed.

This function does not wait for the thread to exit, instead the thread performs an internal detach before exiting so not to leak any pthread resources related to the join operation. Use the function coreThreadStopJoin() to stop a thread and wait for it to exit.


PARAMETERS

h
	Target thread handle.

RETURN VALUE

If successful, coreThreadStop() returns 0. On failure it returns a value of -1 and sets errno to one of the following:

errno ValueCondition
EINVALThe thread handle is invalid.
ECANCELEDThis function is not allowed to stop the main dispatch thread.
EIDRMThe thread handle is stale.

MULTI-THREAD SAFETY LEVEL

MT-safe.


SEE ALSO

Functions:
coreThreadStart() coreThreadStopJoin() coreThreadAttach() coreThreadDetach() coreThreadSocketAdd() coreThreadSocketRemove() corehThread()