![]() |
This is Unofficial EPICS BASE Doxygen Site
|
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <syslog.h>
#include <limits.h>
#include <pthread.h>
#include <rtems.h>
#include <rtems/error.h>
#include "epicsStdio.h"
#include "errlog.h"
#include "epicsMutex.h"
#include "epicsString.h"
#include "epicsThread.h"
#include "cantProceed.h"
#include "osiUnistd.h"
#include "osdInterrupt.h"
#include "epicsExit.h"
#include "epicsAtomic.h"
Go to the source code of this file.
Classes | |
struct | taskVar |
struct | bitmap |
Macros | |
#define | __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1 |
#define | RTEMS_NOTEPAD_TASKVAR 11 |
#define | EPICS_THREAD_ONCE_DONE (epicsThreadId) 1 |
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 1 |
Definition at line 15 of file osdThread.c.
#define EPICS_THREAD_ONCE_DONE (epicsThreadId) 1 |
#define RTEMS_NOTEPAD_TASKVAR 11 |
Definition at line 62 of file osdThread.c.
epicsThreadId epicsThreadCreateOpt | ( | const char * | name, |
EPICSTHREADFUNC | funptr, | ||
void * | parm, | ||
const epicsThreadOpts * | opts | ||
) |
Allocate and start a new OS thread.
name | A name describing this thread. Appears in various log and error message. |
funptr | The thread main function. |
parm | Passed to thread main function. |
opts | Modifiers for the new thread, or NULL to use target specific defaults. |
Definition at line 308 of file osdThread.c.
void epicsThreadExitMain | ( | void | ) |
If the main routine is done but wants to let other threads run it can call this routine. This should be the last call in main, except the final return. On most systems epicsThreadExitMain never returns.This must only be called by the main thread.
Definition at line 219 of file osdThread.c.
LIBCOM_API int epicsThreadGetCPUs | ( | void | ) |
Return a value approximating the number of threads which this target can run in parallel. This value is advisory.
Definition at line 862 of file osdThread.c.
epicsThreadId epicsThreadGetId | ( | const char * | name | ) |
Attempt to find the first instance of a thread by name.
Definition at line 579 of file osdThread.c.
epicsThreadId epicsThreadGetIdSelf | ( | void | ) |
Find an epicsThreadId associated with the current thread. For non-EPICS threads, a new epicsThreadId may be allocated.
Definition at line 510 of file osdThread.c.
void epicsThreadGetName | ( | epicsThreadId | id, |
char * | name, | ||
size_t | size | ||
) |
Copy out the thread name into the provided buffer.
Guaranteed to be null terminated. size is number of bytes in buffer to hold name (including terminator). Failure results in an empty string stored in name.
Definition at line 528 of file osdThread.c.
const char* epicsThreadGetNameSelf | ( | void | ) |
Return the name of the current thread.
This is either a copy of the string passed to epicsThread*Create*(), or an arbitrary unique string for non-EPICS threads.
Definition at line 518 of file osdThread.c.
int epicsThreadGetOsiPriorityValue | ( | int | ossPriority | ) |
Definition at line 85 of file osdThread.c.
int epicsThreadGetOssPriorityValue | ( | unsigned int | osiPriority | ) |
Definition at line 98 of file osdThread.c.
unsigned int epicsThreadGetPriority | ( | epicsThreadId | id | ) |
Return thread OSI priority
Definition at line 434 of file osdThread.c.
unsigned int epicsThreadGetPrioritySelf | ( | void | ) |
Return thread OSI priority
Definition at line 447 of file osdThread.c.
unsigned int epicsThreadGetStackSize | ( | epicsThreadStackSizeClass | size | ) |
Get a stack size value that can be given to epicsThreadCreate().
size | one of the values epicsThreadStackSmall, epicsThreadStackMedium or epicsThreadStackBig. |
Definition at line 140 of file osdThread.c.
LIBCOM_API epicsThreadBooleanStatus epicsThreadHighestPriorityLevelBelow | ( | unsigned int | priority, |
unsigned * | pPriorityJustBelow | ||
) |
Lookup the next usage OSI priority such that priority > *pPriorityJustBelow if this is possible with the current target configuration and privlages.
Definition at line 128 of file osdThread.c.
int epicsThreadIsEqual | ( | epicsThreadId | id1, |
epicsThreadId | id2 | ||
) |
Test if two thread IDs actually refer to the same OS thread
Definition at line 466 of file osdThread.c.
int epicsThreadIsSuspended | ( | epicsThreadId | id | ) |
How and why a thread can be suspended is implementation dependent. A thread calling epicsThreadSuspendSelf() should result in this routine returning true for that thread, but a thread may also be suspended for other reasons.
Definition at line 472 of file osdThread.c.
LIBCOM_API epicsThreadBooleanStatus epicsThreadLowestPriorityLevelAbove | ( | unsigned int | priority, |
unsigned * | pPriorityJustAbove | ||
) |
Lookup the next usage OSI priority such that priority < *pPriorityJustBelow if this is possible with the current target configuration and privlages.
Definition at line 112 of file osdThread.c.
void epicsThreadMap | ( | EPICS_THREAD_HOOK_ROUTINE | func | ) |
Call func once for every known thread.
Definition at line 820 of file osdThread.c.
void epicsThreadMustJoin | ( | epicsThreadId | id | ) |
Wait for a joinable thread to exit (return from its main function)
Definition at line 367 of file osdThread.c.
void epicsThreadOnce | ( | epicsThreadOnceId * | id, |
void(*)(void *) | func, | ||
void * | arg | ||
) |
Definition at line 602 of file osdThread.c.
epicsThreadPrivateId epicsThreadPrivateCreate | ( | void | ) |
Allocate a new thread local variable. This variable will initially hold NULL for each thread.
Definition at line 633 of file osdThread.c.
void epicsThreadPrivateDelete | ( | epicsThreadPrivateId | id | ) |
Free a thread local variable
Definition at line 645 of file osdThread.c.
void* epicsThreadPrivateGet | ( | epicsThreadPrivateId | ) |
Fetch the current value of a thread local variable
Definition at line 671 of file osdThread.c.
void epicsThreadPrivateSet | ( | epicsThreadPrivateId | , |
void * | |||
) |
void epicsThreadRealtimeLock | ( | void | ) |
When real-time scheduling is active, attempt any post-init operations that preserve real-time performance. For POSIX targets this locks the process into RAM, preventing swap-related VM faults.
Definition at line 301 of file osdThread.c.
void epicsThreadResume | ( | epicsThreadId | id | ) |
void epicsThreadSetPriority | ( | epicsThreadId | id, |
unsigned int | priority | ||
) |
Change OSI priority of target thread.
Definition at line 453 of file osdThread.c.
void epicsThreadShow | ( | epicsThreadId | id, |
unsigned int | level | ||
) |
Print info about a single EPICS thread.
Definition at line 800 of file osdThread.c.
void epicsThreadShowAll | ( | unsigned int | level | ) |
Print to stdout information about all running EPICS threads.
level | 0 prints minimal output. Higher values print more details. |
Definition at line 837 of file osdThread.c.
void epicsThreadSleep | ( | double | seconds | ) |
Block the calling thread for at least the specified time.
seconds | Time to wait in seconds. Values <=0 blocks for the shortest possible time. |
Definition at line 490 of file osdThread.c.
double epicsThreadSleepQuantum | ( | void | ) |
Query a value approximating the OS timer/scheduler resolution.
Definition at line 855 of file osdThread.c.
void epicsThreadSuspendSelf | ( | void | ) |
LIBCOM_API void osdThreadHooksRun | ( | epicsThreadId | id | ) |
Definition at line 105 of file osdThreadHooks.c.
LIBCOM_API void osdThreadHooksRunMain | ( | epicsThreadId | id | ) |
Definition at line 99 of file osdThreadHooks.c.
epicsThreadId threadMustCreate | ( | const char * | name, |
unsigned int | priority, | ||
unsigned int | stackSize, | ||
EPICSTHREADFUNC | funptr, | ||
void * | parm | ||
) |
Definition at line 356 of file osdThread.c.