NXThreadSuspend

Suspends the execution of a specified thread and returns when the target thread is suspended.

Library:LibC
Classification:NKS
Service:Threads

Syntax

  #include <nks/thread.h>
   
  int NXThreadSuspend (
     NXThreadId_t   tid);
  

Parameters

tid

(IN) Specifies the ID of the thread to suspend.

Return Values

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

Decimal

Hex

Constant

Description

15

0x0F

NX_EDEADLK

Target thread is the calling thread.

77

0x4D

NX_ESRCH

The specified thread ID is invalid.

Remarks

The thread that calls NXThreadSuspend blocks until the suspension is granted, which might not be immediately. For example:

  • A thread can disable suspension by calling nxCancelDisable, which stays in effect until the thread calls nxCancelEnable.

  • If a thread has acquired a lock, LibC prohibits suspension until the lock is released.

Calling NXThreadSuspend on a thread that is already suspended has no effect.

A suspended thread can be resumed by calling NXThreadContinue.

IMPORTANT:A thread cannot suspend itself.

See Also