SetThreadContextSpecifier

Determines the CLIB context that is to be used by all callback routines scheduled by the specified thread

Local Servers:nonblocking
Remote Servers:N/A
Classification:4.x, 5.x, 6.x
Service:Thread

Syntax

  #include <nwthread.h>  
   
  int SetThreadContextSpecifier (  
     int   threadID,   
     int   contextSpecifier); 
  

Parameters

threadID
(IN) Specifies the ID of the thread whose context specifier you want to get.
contextSpecifier
(IN) Specifies the context to give callback threads.

Return Values

The following table lists return values and descriptions.

Value

Hex

Name

–1

 

EFAILURE

0

(0x00)

ESUCCESS

Remarks

Many of the functions that are registered as callbacks run as OS threads. These threads need CLIB context to use the NetWare API functions, such as printf. This function is used to determine what context is given to callbacks when they are registered by the calling thread.

The default setting is for callbacks to have the context of the thread that calls them.

The thread context specifier is set on a per-thread basis. Changing the context specifier for one thread does not change it for any of the other threads. The threadID parameter specifies which thread should have its context specifier set.

The contextSpecifier parameter tells what the context should be. It can be one of the following:

  • NO_CONTEXT-Do not give CLIB context to callback functions when they are registered. You would use this option when your callback is not going to use any NetWare API functions other than local semaphore calls and SetThreadGroupID, which then creates context. You could also use this if you want to manually set the callbacks function with a call to SetThreadGroupID.
  • USE_CURRENT_CONTEXT-Set the context of the callback being scheduled to be the same as the thread that is scheduling the callback. This is the default setting that exists when a new thread is started.
  • A valid thread group ID-Set the context of the callback to this thread group ID. The ID of the current thread group can be returned with a call to GetThreadGroupID.

See Also

GetThreadContextSpecifier, SetThreadGroupID, GetThreadGroupID