GetNLMIDFromThreadID
Returns the ID of the NLM that the specified thread currently belongs to
#include <nwthread.h>
int GetNLMIDFromThreadID (
int threadID,
char *fileName );
If successful, GetNLMIDFromThreadID returns the ID of the NLM that the thread is associated with. On failure, it returns EFAILURE and errno is set to EBADHNDL.
An NLM, such as a library NLM, can take over ownership of another NLM’s threads by calling SetNLMID or SetThreadGroupID. However, an NLM must ensure that it owns all of its threads before unloading.
An NLM can keep track of the IDs of the threads it originates and can use GetNLMIDFromThreadID to determine if it still owns the threads. If at unload time, an NLM determines that it does not own its threads, the NLM must wait until ownership of the threads is returned to it. Then it can safely unload.
GetNLMIDFromThreadID returns the NLM ID only for threads that have CLIB context. This function returns EFAILURE if passed the ID of a thread that is running as an OS thread.
An example of an OS thread is a procedure scheduled with ScheduleSleepAESProcessEvent and with the registering thread’s context specifier set to NO_CONTEXT. The registered thread does not have CLIB context when it runs.
NOTE:The interface to this function might change in the next release of the NetWare API to also return the name of the NLM. Currently, the name it returns is the name of the file that the NLM was loaded from. (An NLM can have a different name from its file name.)