diff --git a/modules/libcom/src/cppStd/epicsAlgorithm.h b/modules/libcom/src/cppStd/epicsAlgorithm.h index e2043cf26..1920fa4e3 100644 --- a/modules/libcom/src/cppStd/epicsAlgorithm.h +++ b/modules/libcom/src/cppStd/epicsAlgorithm.h @@ -12,14 +12,7 @@ * * \brief Contains a few templates out of the C++ standard header algorithm * - * \note The templates are provided here in a much smaller file. Standard algorithm - * contains many templates for sorting and searching through C++ template containers - * which are not used in EPICS. If all you need from there is std::min(), - * std::max() and/or std::swap() your code may compile faster if you include - * epicsAlgorithm.h and use epicsMin(), epicsMax() and epicsSwap() instead. - * - * The C++ standard only requires types to be less-than comparable, so - * the epicsMin and epicsMax templates only use operator <. + * \deprecated Use std::min()/max()/swap() in new code */ #ifndef __EPICS_ALGORITHM_H__ diff --git a/modules/libcom/src/misc/dbDefs.h b/modules/libcom/src/misc/dbDefs.h index 5de0cd922..bda05ed3f 100644 --- a/modules/libcom/src/misc/dbDefs.h +++ b/modules/libcom/src/misc/dbDefs.h @@ -73,9 +73,7 @@ /** \brief Size of a record name without the nil terminator */ #define PVNAME_SZ (PVNAME_STRINGSZ - 1) -/** - * \def PVLINK_STRINGSZ - * \brief Buffer size for the string representation of a DBF_*LINK field +/** \brief Buffer size for the string representation of a DBF_*LINK field */ #define PVLINK_STRINGSZ 1024 diff --git a/modules/libcom/src/misc/epicsExport.h b/modules/libcom/src/misc/epicsExport.h index 13b27b19e..d1c849eaf 100644 --- a/modules/libcom/src/misc/epicsExport.h +++ b/modules/libcom/src/misc/epicsExport.h @@ -35,17 +35,7 @@ extern "C" { typedef void (*REGISTRAR)(void); -/** \brief Generate a name for an export object. - * \param typ Object's data type. - * \param obj Object's name. - * \return C identifier for the export object. - */ #define EPICS_EXPORT_POBJ(typ, obj) pvar_ ## typ ## _ ## obj - -/** \brief Generate a name for an export function object. - * \param fun Function's name. - * \return C identifier for the export object. - */ #define EPICS_EXPORT_PFUNC(fun) EPICS_EXPORT_POBJ(func, fun) /** \brief Declare an object for exporting. @@ -79,6 +69,8 @@ typedef void (*REGISTRAR)(void); * * \param typ Object's data type. * \param obj Object's name. + * + * \note C++ code needs to wrap with @code extern "C" { } @endcode */ #define epicsExportAddress(typ, obj) \ epicsShareExtern typ *EPICS_EXPORT_POBJ(typ,obj); \ @@ -96,6 +88,8 @@ typedef void (*REGISTRAR)(void); \endcode * * \param fun Registrar function's name. + * + * \note C++ code needs to wrap with @code extern "C" { } @endcode */ #define epicsExportRegistrar(fun) \ epicsShareFunc REGISTRAR EPICS_EXPORT_PFUNC(fun) = (REGISTRAR) &fun @@ -111,6 +105,8 @@ typedef void (*REGISTRAR)(void); \endcode * * \param fun Function's name + * + * \note C++ code needs to wrap with @code extern "C" { } @endcode */ #define epicsRegisterFunction(fun) \ static void register_func_ ## fun(void) \ diff --git a/modules/libcom/src/misc/epicsUnitTest.h b/modules/libcom/src/misc/epicsUnitTest.h index f090eb192..302c87bf5 100644 --- a/modules/libcom/src/misc/epicsUnitTest.h +++ b/modules/libcom/src/misc/epicsUnitTest.h @@ -88,14 +88,16 @@ MAIN(iocTest) { - iocBuildIsolated() || iocRun(); - - ... test code ... - - iocShutdown(); - dbFreeBase(pdbbase); - registryFree(); - pdbbase = NULL; + testPlan(0); + testdbPrepare(); + testdbReadDatabase(".dbd", 0, 0); + _registerRecordDeviceDriver(pdbbase); + testdbReadDatabase("some.db", 0, 0); + ... test code before iocInit(). eg. dbGetString() ... + testIocInitOk(); + ... test code with IOC running. eg. dbGet() + testIocShutdownOk(); + testdbCleanup(); return testDone(); } \endcode @@ -235,6 +237,15 @@ LIBCOM_API int testDiag(const char *fmt, ...) */ LIBCOM_API int testDone(void); +/** \brief Return non-zero in shared/oversubscribed testing envrionments + * + * May be used to testSkip(), or select longer timeouts, for some cases + * when the test process may be preempted for arbitrarily long times. + * This is common in shared CI environments. + * + * The environment variable $EPICS_TEST_IMPRECISE_TIMING=YES should be + * set in by such testing environments. + */ LIBCOM_API int testImpreciseTiming(void); diff --git a/modules/libcom/src/osi/epicsEvent.h b/modules/libcom/src/osi/epicsEvent.h index 9429b9db6..dfa8a4fdf 100644 --- a/modules/libcom/src/osi/epicsEvent.h +++ b/modules/libcom/src/osi/epicsEvent.h @@ -20,12 +20,12 @@ * * When creating the consumer thread also create an epicsEvent. \code - epicsEvent *pevent = new epicsEvent; + epicsEvent event; \endcode * The consumer thread has code containing: \code while(1) { - pevent->wait(); + pevent.wait(); while( {more work} ) { {process work} } @@ -33,7 +33,7 @@ \endcode * Producers create requests and issue the statement: \code - pevent->trigger(); + pevent.trigger(); \endcode **/ diff --git a/modules/libcom/src/osi/epicsMutex.h b/modules/libcom/src/osi/epicsMutex.h index af27f2f96..6c79fd9e0 100644 --- a/modules/libcom/src/osi/epicsMutex.h +++ b/modules/libcom/src/osi/epicsMutex.h @@ -19,12 +19,18 @@ * * The typical C++ use of a mutual exclusion semaphore is: \code - epicsMutex *plock = new epicsMutex; + epicsMutex lock; ... ... - plock->lock(); - // process resources - plock->unlock(); + { + epicsMutex::guard_t G(lock); // lock + // process resources + } // unlock + // or for compatiblity + { + epicsGuard G(lock); // lock + // process resources + } // unlock \endcode * * \note The implementation: diff --git a/modules/libcom/src/osi/epicsTime.h b/modules/libcom/src/osi/epicsTime.h index a1ccf382d..fcfa679a5 100644 --- a/modules/libcom/src/osi/epicsTime.h +++ b/modules/libcom/src/osi/epicsTime.h @@ -155,10 +155,10 @@ public: static epicsTime getCurrent (); /** \brief Get current monotonic time * - * Returns an epicsTime containing the current monotonic time, a - * high-resolution OS clock that counts at a steady rate, never - * going backwards or jumping forwards. This time is only useful - * for measuring time differences. + * Returns an epicsTime containing the current monotonic time, an + * OS clock which never going backwards or jumping forwards. + * This time is has an undefined epoch, and is only useful for + * measuring time differences. */ static epicsTime getMonotonic ();