summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_getcurrentthread.rst
blob: b954deb16db120d0da08a44f97f645f25a4616ed (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::

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