summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_getcurrentthread.rst
blob: b198ce1a6aea462542049be7e37fff33ac0969e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
PR_GetCurrentThread
===================

Returns the current thread object for the currently running code.


Syntax
------

.. code::

   #include <prthread.h>

   PRThread* PR_GetCurrentThread(void);


Returns
~~~~~~~

Always returns a valid reference to the calling thread--a self-identity.


Description
~~~~~~~~~~~

The currently running thread may discover its own identity by calling
:ref:`PR_GetCurrentThread`.

.. note::

   **Note**: This is the only safe way to establish the identity of a
   thread. Creation and enumeration are both subject to race conditions.