Shared Persistent Heap Data Environment Manual
1.1.0
|
Thread utility functions. More...
#include <unistd.h>
Go to the source code of this file.
Functions | |
__C__ pid_t | sphdeGetPID (void) |
Return the process identification. More... | |
__C__ pid_t | sphdeGetTID (void) |
Return the thread identification. More... | |
__C__ char * | sphdeGetCmdLine (void) |
Return the command line string. More... | |
static int | sphFastGetPID (void) |
Return the process identification. More... | |
__thread pid_t threadID | __attribute__ ((tls_model("initial-exec"))) |
static int | sphFastGetTID (void) |
Return the thread identification. More... | |
Variables | |
pid_t | procID |
Thread utility functions.
The process pid can be obtained using sphdeGetPID, thread id by sphdeGetTID, and command line string by sphdeGetCmdLine. Fast versions that access static variables and avoid syscall where possible are provided: sphFastGetPID for process id and sphFastGetTID for thread id.
For instance, to provide a fast event log header:
__thread pid_t threadID __attribute__ | ( | (tls_model("initial-exec")) | ) |
Per-thread thread identification variable. Should not be accessed directly, instead the function sphFastGetTID should be used.
__C__ char* sphdeGetCmdLine | ( | void | ) |
Return the command line string.
The command line is obtained from '/proc/pid/cmdline' and maintained in an internal static variable.
__C__ pid_t sphdeGetPID | ( | void | ) |
Return the process identification.
The function issues a syscall when needed and it also update its internal command line value (so a subsequent call to sphdeGetCmdLine will just return the already available command line value).
__C__ pid_t sphdeGetTID | ( | void | ) |
Return the thread identification.
The function issues a syscall when needed. The thread identification value is a per-thread variable so a subsequent call to sphFastGetTID will just need to return a variable value (no syscall needed).
|
inlinestatic |
Return the process identification.
Fast version of sphdeGetPID.
|
inlinestatic |
Return the thread identification.
Fast version of sphdeGetTID.
pid_t procID |
Process identification variable. Should not be accessed directly, instead the function sphFastGetPID should be used.