Rework EPICS_THREAD_CAN_JOIN

RTEMS osdThread.h was missing an extern "C" wrapper.
This commit is contained in:
Andrew Johnson
2019-07-02 17:31:37 -05:00
parent fbf62189cb
commit 99be9a86a0
7 changed files with 29 additions and 34 deletions
+4 -1
View File
@@ -124,7 +124,10 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadCreate (
epicsShareFunc epicsThreadId epicsShareAPI epicsThreadMustCreate (
const char * name, unsigned int priority, unsigned int stackSize,
EPICSTHREADFUNC funptr,void * parm );
/** Wait for a joinable thread to exit (return from its main function */
/* This gets undefined in osdThread.h on VxWorks < 6.9 */
#define EPICS_THREAD_CAN_JOIN
/** Wait for a joinable thread to exit (return from its main function) */
epicsShareFunc void epicsThreadMustJoin(epicsThreadId id);
/** Block the current thread until epicsThreadResume(). */
epicsShareFunc void epicsShareAPI epicsThreadSuspendSelf(void);
@@ -16,9 +16,6 @@
#include "ellLib.h"
#include "epicsEvent.h"
/* This target supports joining threads */
#define EPICS_THREAD_CAN_JOIN (1)
#ifdef __cplusplus
extern "C" {
#endif
+13 -5
View File
@@ -3,13 +3,21 @@
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* This target supports joining threads */
#define EPICS_THREAD_CAN_JOIN (1)
#ifndef INC_osdThread_H
#define INC_osdThread_H
#ifdef __cplusplus
extern "C" {
#endif
int epicsThreadGetOssPriorityValue(unsigned int osiPriority);
#ifdef __cplusplus
}
#endif
#endif /* INC_osdThread_H */
+2 -6
View File
@@ -3,15 +3,11 @@
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef osdThreadh
#define osdThreadh
/* This target supports joining threads */
#define EPICS_THREAD_CAN_JOIN (1)
#endif /* osdThreadh */
+2 -6
View File
@@ -3,9 +3,8 @@
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef osdThreadh
#define osdThreadh
@@ -16,9 +15,6 @@
#include "ellLib.h"
#include "epicsEvent.h"
/* This target supports joining threads */
#define EPICS_THREAD_CAN_JOIN (1)
#ifdef __cplusplus
extern "C" {
#endif
@@ -34,7 +34,7 @@
#include "vxLib.h"
#include "epicsExit.h"
#if EPICS_THREAD_CAN_JOIN
#ifdef EPICS_THREAD_CAN_JOIN
/* The implementation of epicsThreadMustJoin() here uses 2 features
* of VxWorks that were first introduced in VxWorks 6.9: taskWait(),
* and the taskSpareFieldGet/Set routines in taskUtilLib.
@@ -188,7 +188,7 @@ void epicsThreadOnce(epicsThreadOnceId *id, void (*func)(void *), void *arg)
semGive(epicsThreadOnceMutex);
}
#if EPICS_THREAD_CAN_JOIN
#ifdef EPICS_THREAD_CAN_JOIN
/* This routine is not static so it appears in the back-trace
* of a thread that is waiting to be joined.
@@ -286,8 +286,8 @@ epicsThreadId epicsThreadCreateOpt(const char * name,
void epicsThreadMustJoin(epicsThreadId id)
{
#ifdef EPICS_THREAD_CAN_JOIN
const char *fn = "epicsThreadMustJoin";
#if EPICS_THREAD_CAN_JOIN
int tid = (int) id;
SEM_ID joinSem;
STATUS status;
@@ -340,8 +340,6 @@ void epicsThreadMustJoin(epicsThreadId id)
}
cantProceed(fn);
}
#else
cantProceed("%s called when EPICS_THREAD_CAN_JOIN is 0\n", fn);
#endif
}
@@ -3,20 +3,17 @@
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef osdThreadh
#define osdThreadh
/* VxWorks 6.9 and later can support joining threads */
#if (_WRS_VXWORKS_MAJOR > 6) || \
(_WRS_VXWORKS_MAJOR == 6 && _WRS_VXWORKS_MINOR >= 9)
# define EPICS_THREAD_CAN_JOIN (1)
#else
# define EPICS_THREAD_CAN_JOIN (0)
#if (_WRS_VXWORKS_MAJOR == 6 && _WRS_VXWORKS_MINOR < 9)
#undef EPICS_THREAD_CAN_JOIN
#endif
#endif /* osdThreadh */