NXKeyDelete

Destroys the specified key.

Library:LibC
Classification:NKS
Service:Threads

Syntax

  #include <nks/thread.h> 
   
  int NXKeyDelete (
     NXKey_t    key;
  

Parameters

key

(IN) Specifies the key to destroy.

Return Values

If successful, returns 0; otherwise, returns a nonzero error code:

Decimal

Hex

Constant

Description

9

0x09

NX_EINVAL

The specified key has not been allocated.

14

0x0E

NX_ERANGE

The specified key is invalid (out of range).

Remarks

NXKeyDelete frees up a previously allocated key, which results in revoking the slot number that was reserved in the CSD array of all contexts. Contexts cannot manipulate the value that is associated with the key.

WARNING:When a key is deleted, any associated destructor is not called. You must clean up any values that contexts may have associated with the key before that key is deleted.

Usually, you do not need to destroy a key. When a thread exits, the destructor is automatically called to destroy key values associated with that thread. When the last thread of your VM exits, the destructor is called for the last time and the key is automatically destroyed.

For sample code, see KeyValue.c.

See Also