Synchronization endpoint

The endpoint facilitates using futexes to synchronize threads.

Information about methods of the endpoint is provided in the table below.

Methods of the sync.Sync endpoint (kl.core.Sync interface)

Method

Method purpose and parameters

Potential danger of the method

Wait

Purpose

Locks execution of the calling thread if the futex value is equal to the expected value.

Parameters

  • [in] ptr – pointer to the variable containing the futex value.
  • [in] val – expected value of the futex.
  • [in] delay – maximum blocking duration (in milliseconds).
  • [out] outDelay – actual blocking duration (in milliseconds).
  • [out] rc – return code.

N/A

Wake

Purpose

Resumes execution of threads that are the first in the queue of threads that were locked by calls of the Wait method with the specified futex.

Parameters

  • [in] ptr – pointer to the variable containing the futex value.
  • [in] nThreads – maximum number of threads whose execution will be resumed.
  • [out] wokenCnt – actual number of threads whose execution was resumed.
  • [out] rc – return code.

N/A

PiWait

Purpose

Locks the calling thread.

Parameters

  • [in] ptr – pointer to the variable containing the futex value.
  • [in] delay – maximum blocking duration (in milliseconds).
  • [out] rc – return code.

N/A

PiWake

Purpose

Resumes execution of a thread that is the first in the queue of threads that were locked by calls of the PiWait method with the specified futex.

Parameters

  • [in] ptr – pointer to the variable containing the futex value.
  • [out] rc – return code.

N/A

Page top