NPA_Spawn_Thread

Schedules execution of a blocking or non-blocking asynchronous event, or a timer-interrupt-level callback.

Thread Context:Non-Blocking

Syntax

    LONG NPA_Spawn_Thread (
       LONG   npaHandle 
       void   (*executeRoutine)(),
       LONG   parameter,
       LONG   clockTicks,
       LONG   flag
    );
    

Parameters

npaHandle
(IN) The CDM's or HAM's handle for using the NPA APIs, assigned during NPA_Register_CDM_Module or NPA_Register_HAM_Module, respectively.
executeRoutine
(IN) Points to the CDM or HAM function that is called to execute the spawned thread.
parameter
(IN) Input parameter required by executeRoutine. If executeRoutine does not require an input parameter value, set parameter equal to zero.
clockTicks
Value specifying the time in clock ticks to elapse before this thread is initiated. A clock tick translates to 1/18th of a second (55 milliseconds).
flag
Value specifying whether the spawned thread is blocking or non-blocking:

0x00000000

Indicates a non-blocking thread. (Default)

0x00000001

Indicates a blocking thread.

0x00000002

Indicates the thread is scheduled to execute during the timer chip interrupt following the specified tick count.

Return Values

The following table lists return values and descriptions.

zero

Successful

nonzero

Unsuccessful

Remarks

NPA_Spawn_Thread is used to schedule an asynchronous background thread for a CDM or HAM that becomes active after the time specified in the clockTicks parameter. If the value in clockTicks is zero, the thread is immediately scheduled. Whether scheduling is immediate or delayed, the thread is initiated by NetWare calling the entry point whose address was passed into NPA_Spawn_Thread as an argument. NPA_Spawn_Thread can be used to set up an entry point for a background timer or to create a designated background process that can run throughout the time that the CDM or HAM is loaded in file server memory. An example of a background process is the HAM's timeout handler that monitors the allowable execution time of an I/O request specified in the timeoutAmount field of a HACB.

If the value of the flag parameter is 0, NPA_Spawn_Thread schedules a non-blocking thread. If the spawned thread is non-blocking, no blocking calls can be issued during its context.

If the value of the flag parameter is 1, NPA_Spawn_Thread schedules a blocking thread from which other blocking calls can be made. However, as much as possible, blocking calls should be kept to a minimum to avoid impact on server performance.

If the value of the flag equals 2 (timer interrupt time callback), the execute function must adhere to interrupt level constraints. We suggest that an interrupt time callback keep its execution time under 20 milliseconds.

NPA_Spawn_Thread is a one-shot thread. In order to reschedule an asynchronous thread for execution, NPA_Spawn_Thread must be called again.