NPA_Cancel_Thread

Cancels asynchronous blocking or non-blocking threads of execution scheduled for an NWPA application.

Thread Context:Blocking
Requirements: Interrupts must be disabled.

Syntax

    LONG NPA_Cancel_Thread (
       LONG   npaHandle,
       LONG   (*executeRoutine)(),
       LONG   parameter
       );
    
    

Parameters

npaHandle
(IN) The CDM's or HAM’s handle for using the NPA APIs. Its value was assigned during NPA_Register_CDM_Module or NPA_Register_HAM_Module, respectively.
executeRoutine
(IN) Points to the CDM/HAM function that was originally passed into NPA_Spawn_Thread when the thread was originally spawned.
parameter
(IN) Parameter value that was originally passed into NPA_Spawn_Thread when the thread was originally spawned.

Return Values

The following table lists return values and descriptions.

zero

Successful. Indicates that the spawned thread was successfully cancelled.

nonzero

Unsuccessful. Indicates that the spawned thread could not be cancelled because it is currently running.

Remarks

NPA_Cancel_Thread is used to cancel an instance of an asynchronous thread that was spawned using NPA_Spawn_Thread. NWPA uses the input executeRoutine and parameter parameters to identify the thread to cancel. Therefore, these two parameters must match exactly with the parameters passed to NPA_Spawn_Thread.

A CDM or HAM must make a separate call for each spawned thread it cancels. Additionally, a CDM or HAM must call this function for all pending threads that it spawned before it can unload.