Compare commits

...

21 Commits

Author SHA1 Message Date
Ralph Lange
a7826646c0 GHA: Update actions/upload-artifact to v4 2024-12-16 12:02:06 +01:00
Ralph Lange
f103a0b376 Update ci-scripts to 3.4.1
Builds on AppVeyor (VS2019) started to fail
because of the Python version/distutils
2024-03-01 18:07:55 +01:00
Andrew Johnson
a249561677 Added darwin-aarch64 support from 7.0 branch 2022-08-21 16:17:29 -05:00
Andrew Johnson
96887926bf Merge Freddie's set_thread_descriptions branch
PR #270
2022-08-21 16:01:51 -05:00
Andrew Johnson
c8647ffab7 Added Release Note 2022-08-21 16:00:30 -05:00
Freddie Akeroyd
4b884c15b1 SetThreadName: Add WINAPI (correctly) for 32bit builds 2022-05-24 14:40:46 +01:00
Freddie Akeroyd
0ace4e4a30 SetThreadName: Add WINAPI for 32bit builds 2022-05-24 14:21:12 +01:00
Freddie Akeroyd
3cf2d3737f Use SetThreadDescription(), if available, to set thread name 2022-05-24 13:24:42 +01:00
Ralph Lange
7c168f20f4 Fix gdd string to double conversion
This is an alternative fix for the issue described in
https://github.com/epics-modules/pcas/issues/4 and
https://github.com/epics-extensions/ca-gateway/issues/37
that keeps the call to epicsScanDouble() before trying
sscanf() first with "%lf" (ignoring extra characters)
then with "%x" (to catch hex numbers).
(closes #216)
2021-12-08 17:07:11 +01:00
Andrew Johnson
5cddcea829 Change the epicsTimerTest delayVerify failure condition
This test verifies timer delays between 1.0 and 3.4 seconds.
A test failure now means the measured delay was more than
0.25 seconds different than the request, instead of being
5% of the request. This should now pass on GHA macOS.

On the 7.0 branch it should call testImpreciseTiming() and
use a smaller absolute delay threshold for better targets.
2021-09-17 11:16:00 -05:00
Andrew Johnson
9b69e63a69 Update GHA config, drop Ubuntu-16.04 builds 2021-09-17 10:06:10 -05:00
Andrew Johnson
422513990e Release notes for Win32 timer fix. 2021-09-16 14:54:31 -05:00
Andrew Johnson
3313860691 Win32 osdThread.c polishing
A little optimization of Freddie's code
Rename the new non-public routine
2021-09-16 14:45:25 -05:00
Andrew Johnson
2b8eb97b79 Merge Freddie's refactor_get_param_win32 branch 2021-09-16 13:28:42 -05:00
Andrew Johnson
9842bd1b20 Prefer to install %.html files from O.Common 2021-09-16 13:21:59 -05:00
Andrew Johnson
e7ea81c7a2 Reference doc tweaks to the dfanout record 2021-09-14 18:26:32 -05:00
Andrew Johnson
c528948f45 Adjust build rules for POD to HTML conversion 2021-09-14 18:25:30 -05:00
Freddie Akeroyd
00e9ecf7b5 Fix typo in osdThreadGetTimer 2021-09-11 22:19:40 +01:00
Freddie Akeroyd
65b34874bd Check for NULL in osdThreadGetTimer 2021-09-11 22:17:09 +01:00
Freddie Akeroyd
939d84f31a Refactor to use common epicsThreadGetParamWIN32() function 2021-09-11 22:10:10 +01:00
Andrew Johnson
67fcd65656 Update versions after tagging 2021-06-27 12:20:41 -05:00
15 changed files with 198 additions and 139 deletions

2
.ci

Submodule .ci updated: ad8dd4a136...20f8e05393

View File

@@ -17,6 +17,12 @@ on:
- '**/*.html'
- '**/*.md'
pull_request:
paths-ignore:
- 'documentation/*'
- 'startup/*'
- '.appveyor/*'
- '**/*.html'
- '**/*.md'
env:
SETUP_PATH: .ci-local:.ci
@@ -57,11 +63,6 @@ jobs:
extra: "CMD_CXXFLAGS=-std=c++11"
name: "Ub-20 gcc-9 C++11, static"
- os: ubuntu-16.04
cmp: clang
configuration: default
name: "Ub-16 clang-9"
- os: ubuntu-20.04
cmp: clang
configuration: default
@@ -80,18 +81,6 @@ jobs:
rtems: "4.9"
name: "Ub-20 gcc-9 + RT-4.9"
- os: ubuntu-16.04
cmp: gcc-4.8
utoolchain: true
configuration: default
name: "Ub-16 gcc-4.8"
- os: ubuntu-16.04
cmp: gcc-4.9
utoolchain: true
configuration: default
name: "Ub-16 gcc-4.9"
- os: ubuntu-20.04
cmp: gcc-8
utoolchain: true
@@ -143,9 +132,12 @@ jobs:
- name: Run main module tests
run: python .ci/cue.py test
- name: Upload tapfiles Artifact
uses: actions/upload-artifact@v2
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: tapfiles ${{ matrix.name }}
path: '**/O.*/*.tap'
if-no-files-found: ignore
- name: Collect and show test results
if: ${{ always() }}
run: python .ci/cue.py test-results

View File

@@ -31,15 +31,11 @@ EPICS_MODIFICATION = 9
# EPICS_PATCH_LEVEL must be a number (win32 resource file requirement)
# Not included if zero
EPICS_PATCH_LEVEL = 0
EPICS_PATCH_LEVEL = 1
# This will end in -DEV between official releases
#EPICS_DEV_SNAPSHOT=-DEV
#EPICS_DEV_SNAPSHOT=-pre1
#EPICS_DEV_SNAPSHOT=-pre1-DEV
#EPICS_DEV_SNAPSHOT=-rc1
#EPICS_DEV_SNAPSHOT=-rc1-DEV
EPICS_DEV_SNAPSHOT=
EPICS_DEV_SNAPSHOT=-DEV
#EPICS_DEV_SNAPSHOT=
# No changes should be needed below here

View File

@@ -429,26 +429,26 @@ $(foreach file, $(DBD_INSTALLS), $(eval $(call DBD_INSTALLS_template, $(file))))
##################################################### HTML files
$(COMMON_DIR)/%.html: %.dbd.pod $(TOOLS)/dbdToHtml.pl
@$(RM) $(notdir $@)
@$(RM) $@ $(notdir $@)
$(PERL) $(TOOLS)/dbdToHtml.pl $(DBDFLAGS) -o $(notdir $@) $<
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/%.html: %.pod $(TOOLS)/podToHtml.pl
@$(RM) $(notdir $@)
@$(RM) $@ $(notdir $@)
$(PERL) $(TOOLS)/podToHtml.pl -o $(notdir $@) $<
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/%.html: %.pm $(TOOLS)/podToHtml.pl
@$(RM) $(notdir $@)
@$(RM) $@ $(notdir $@)
$(PERL) $(TOOLS)/podToHtml.pl -o $(notdir $@) $<
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/%.html: ../%.pm $(TOOLS)/podToHtml.pl
@$(RM) $(notdir $@)
@$(RM) $@ $(notdir $@)
$(PERL) $(TOOLS)/podToHtml.pl -o $(notdir $@) $<
@$(MV) $(notdir $@) $@
.PRECIOUS: $(COMMON_DIR)/%.html %.html
.PRECIOUS: $(COMMON_DIR)/%.html
##################################################### DB files

View File

@@ -498,6 +498,10 @@ $(INSTALL_DOC)/%: ../%
$(ECHO) "Installing doc $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(INSTALL_DOC)
$(INSTALL_HTML)/$(HTMLS_DIR)/%: $(COMMON_DIR)/%
$(ECHO) "Installing generated html $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
$(INSTALL_HTML)/$(HTMLS_DIR)/%: %
$(ECHO) "Installing html $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
@@ -506,10 +510,6 @@ $(INSTALL_HTML)/$(HTMLS_DIR)/%: ../%
$(ECHO) "Installing html $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
$(INSTALL_HTML)/$(HTMLS_DIR)/%: $(COMMON_DIR)/%
$(ECHO) "Installing generated html $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
$(INSTALL_TEMPLATES_SUBDIR)/%: ../%
$(ECHO) "Installing $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)

View File

@@ -0,0 +1,14 @@
# CONFIG.Common.darwin-aarch64
#
# This file is maintained by the build community.
#
# Definitions for darwin-aarch64 target builds
# Sites may override these definitions in CONFIG_SITE.Common.darwin-aarch64
#-------------------------------------------------------
#
# To build universal binaries, configure ARCH_CLASS
# in the file CONFIG_SITE.Common.darwin-aarch64
# Include definitions common to all Darwin targets
include $(CONFIG)/os/CONFIG.darwinCommon.darwinCommon

View File

@@ -0,0 +1,8 @@
# CONFIG.darwin-aarch64.Common
#
# Definitions for darwin-aarch64 host builds
# Sites may override these definitions in CONFIG_SITE.darwin-aarch64.Common
#-------------------------------------------------------
#Include definitions common to unix hosts
include $(CONFIG)/os/CONFIG.UnixCommon.Common

View File

@@ -0,0 +1,9 @@
# CONFIG_SITE.Common.darwin-aarch64
#
# Site override definitions for darwin-aarch64 target builds
#-------------------------------------------------------
#
# arm64 devices: Apple Silicon M1
ARCH_CLASS = arm64

View File

@@ -1,5 +1,30 @@
# EPICS Base Release 3.15.9
This version of EPICS Base has not been released yet.
## Changes made on the 3.15 branch since 3.15.9
<!-- Insert new items immediately below here ... -->
### Support for Apple M1/M2 (arm64) Processors
Thanks to Jeong Han Lee this release comes with build support for Apple's new
M1 CPUs running macOS, using the target name `darwin-aarch64`.
### Set thread names on Windows
On MS Windows, epicsThread names are made available to the OS and debugger
using `SetThreadDescription()` if available as well as using the older
exception mechanism.
### Fix timers on MS Windows for non-EPICS threads
The waitable timer changes in 3.15.9 broke calls to `epicsThreadSleep()` and
similar routines that used timers (including `ca_pend_event()`) when made from
threads that were not started using the epicsThread APIs.
[This problem](https://github.com/epics-base/epics-base/pull/200)
[has now been fixed](https://github.com/epics-base/epics-base/pull/201).
## Changes made between 3.15.8 and 3.15.9
### Use waitable timers on Microsoft Windows

View File

@@ -50,14 +50,16 @@ bool getStringAsDouble ( const char * pString,
ftmp = itmp;
}
else {
int j = epicsScanDouble( pString, &ftmp );
if ( j != 1 ) {
j = sscanf ( pString,"%x", &itmp );
if ( j == 1 ) {
ftmp = itmp;
}
else {
return false;
int j = epicsScanDouble ( pString, &ftmp );
if ( j != 1 ) {
j = sscanf ( pString, "%lf", &ftmp );
if ( j != 1 ) {
j = sscanf ( pString, "%x", &itmp );
if ( j == 1 ) {
ftmp = itmp;
} else {
return false;
}
}
}
}

View File

@@ -477,21 +477,6 @@ epicsShareFunc unsigned int epicsShareAPI
return stackSizeTable[stackSizeClass];
}
void epicsThreadCleanupWIN32 ()
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm;
if ( ! pGbl ) {
fprintf ( stderr, "epicsThreadCleanupWIN32: unable to find ctx\n" );
return;
}
pParm = ( win32ThreadParam * )
TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS );
epicsParmCleanupWIN32 ( pParm );
}
/*
* epicsWin32ThreadEntry()
*/
@@ -662,21 +647,34 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadCreate (const char *pName,
}
/*
* epicsThreadSuspendSelf ()
* getMyWin32ThreadParam ()
*/
epicsShareFunc void epicsShareAPI epicsThreadSuspendSelf ()
static void* getMyWin32ThreadParam ( win32ThreadGlobal * pGbl )
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm;
DWORD stat;
assert ( pGbl );
if ( ! pGbl ) {
pGbl = fetchWin32ThreadGlobal ();
assert ( pGbl );
}
pParm = ( win32ThreadParam * )
TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS );
if ( ! pParm ) {
pParm = epicsThreadImplicitCreate ();
}
return pParm;
}
/*
* epicsThreadSuspendSelf ()
*/
epicsShareFunc void epicsShareAPI epicsThreadSuspendSelf ()
{
DWORD stat;
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm = getMyWin32ThreadParam ( pGbl );
if ( pParm ) {
EnterCriticalSection ( & pGbl->mutex );
pParm->isSuspended = 1;
@@ -721,16 +719,8 @@ epicsShareFunc unsigned epicsShareAPI epicsThreadGetPriority (epicsThreadId id)
*/
epicsShareFunc unsigned epicsShareAPI epicsThreadGetPrioritySelf ()
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm;
win32ThreadParam * pParm = getMyWin32ThreadParam ( NULL );
assert ( pGbl );
pParm = ( win32ThreadParam * )
TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS );
if ( ! pParm ) {
pParm = epicsThreadImplicitCreate ();
}
if ( pParm ) {
return pParm->epicsPriority;
}
@@ -791,15 +781,12 @@ epicsShareFunc int epicsShareAPI epicsThreadIsSuspended ( epicsThreadId id )
*/
HANDLE osdThreadGetTimer()
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm;
assert ( pGbl );
pParm = ( win32ThreadParam * )
TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS );
return pParm->timer;
win32ThreadParam * pParm = getMyWin32ThreadParam ( NULL );
if (pParm) {
return pParm->timer;
} else {
return NULL;
}
}
/*
@@ -880,17 +867,8 @@ double epicsShareAPI epicsThreadSleepQuantum ()
*/
epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetIdSelf (void)
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm;
assert ( pGbl );
pParm = ( win32ThreadParam * ) TlsGetValue (
pGbl->tlsIndexThreadLibraryEPICS );
if ( ! pParm ) {
pParm = epicsThreadImplicitCreate ();
assert ( pParm ); /* very dangerous to allow non-unique thread id into use */
}
win32ThreadParam * pParm = getMyWin32ThreadParam ( NULL );
assert ( pParm ); /* very dangerous to allow non-unique thread id into use */
return ( epicsThreadId ) pParm;
}
@@ -927,19 +905,7 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadGetId ( const char * pName
*/
epicsShareFunc const char * epicsShareAPI epicsThreadGetNameSelf (void)
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm;
if ( ! pGbl ) {
return "thread library not initialized";
}
pParm = ( win32ThreadParam * )
TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS );
if ( ! pParm ) {
pParm = epicsThreadImplicitCreate ();
}
win32ThreadParam * pParm = getMyWin32ThreadParam ( NULL );
if ( pParm ) {
if ( pParm->pName ) {
return pParm->pName;

View File

@@ -8,44 +8,86 @@
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#define VC_EXTRALEAN
#define STRICT
#if _WIN64
# define _WIN32_WINNT 0x400 /* defining this drops support for W95 */
#endif
#include <windows.h>
#include <string>
/*
* this was copied directly from an example in visual c++ 7 documentation,
* It uses visual C++ specific keywords for exception handling, but is
* probably only useful when using the visual c++ or later debugger.
*
* Usage: setThreadName (-1, "MainThread");
*/
static void setThreadNameVS ( DWORD dwThreadID, LPCSTR szThreadName );
typedef HRESULT (WINAPI* setDesc_t)(HANDLE, PCWSTR);
extern "C" void setThreadName ( DWORD dwThreadID, LPCSTR szThreadName )
{
static HMODULE hKernel = LoadLibrary("KernelBase.dll");
static setDesc_t pSetDesc = (hKernel != NULL ?
(setDesc_t)GetProcAddress(hKernel, "SetThreadDescription") : NULL);
if (szThreadName == NULL || *szThreadName == '\0')
{
return;
}
if (pSetDesc != NULL)
{
#ifdef THREAD_SET_LIMITED_INFORMATION
DWORD thread_access = THREAD_SET_LIMITED_INFORMATION;
#else
DWORD thread_access = THREAD_SET_INFORMATION;
#endif /* ifdef THREAD_SET_LIMITED_INFORMATION */
HANDLE hThread = OpenThread(thread_access, FALSE, dwThreadID);
if (hThread != NULL)
{
const std::string s(szThreadName);
const std::wstring ws(s.begin(), s.end());
HRESULT hr = (*pSetDesc)(hThread, ws.c_str());
CloseHandle(hThread);
}
}
// if SetThreadDescription() was available and we have a recent
// visual studio debugger (2017 version 15.6 or higher) attached
// then the names will already be defined. However we don't know
// this for sure, so also trigger the old exception mechanism.
// See https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
setThreadNameVS(dwThreadID, szThreadName);
}
static void setThreadNameVS( DWORD dwThreadID, LPCSTR szThreadName )
{
#if _MSC_VER >= 1300 && defined ( _DEBUG )
// This was copied directly from an MSDN example
// It sets the thread name by throwing a special exception that is caught by Visual Sudio
// It requires the debugger to be already attached to the process
// when the exception is thrown for the name to be registered
static const DWORD MS_VC_EXCEPTION = 0x406D1388;
#pragma pack(push,8)
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // must be 0x1000
LPCSTR szName; // pointer to name (in user addr space)
DWORD dwThreadID; // thread ID (-1=caller thread)
DWORD dwFlags; // reserved for future use, must be zero
DWORD dwType; // Must be 0x1000.
LPCSTR szName; // Pointer to name (in user addr space).
DWORD dwThreadID; // Thread ID (-1=caller thread).
DWORD dwFlags; // Reserved for future use, must be zero.
} THREADNAME_INFO;
#pragma pack(pop)
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = szThreadName;
info.dwThreadID = dwThreadID;
info.dwFlags = 0;
#pragma warning(push)
#pragma warning(disable: 6320 6322)
__try
{
RaiseException( 0x406D1388, 0,
sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info );
RaiseException(MS_VC_EXCEPTION, 0,
sizeof(info) / sizeof(ULONG_PTR),
(ULONG_PTR*)&info);
}
__except(EXCEPTION_CONTINUE_EXECUTION)
__except (EXCEPTION_EXECUTE_HANDLER)
{
}
#pragma warning(pop)
#endif
}

View File

@@ -108,13 +108,14 @@ inline double delayVerify::delay () const
double delayVerify::checkError () const
{
const double messageThresh = 5.0; // percent
double actualDelay = this->expireStamp - this->beginStamp;
double measuredError = actualDelay - this->expectedDelay;
double percentError = 100.0 * fabs ( measuredError ) / this->expectedDelay;
testOk ( percentError < messageThresh, "%f < %f, delay = %f s, error = %f s (%.1f %%)",
percentError, messageThresh,
this->expectedDelay, measuredError, percentError );
const double minError = 0.25;
double measuredDelay = this->expireStamp - this->beginStamp;
double measuredError = measuredDelay - this->expectedDelay;
double absoluteError = fabs(measuredError);
double percentError = 100.0 * measuredError / this->expectedDelay;
testOk(absoluteError < minError,
"Delay %.3f s, error = %+.6f ms (%+.3f %%)",
this->expectedDelay, measuredError * 1000, percentError);
return measuredError;
}

View File

@@ -99,22 +99,23 @@ SELM is a menu, with three choices:
=menu dfanoutSELM
If SELM=="All", then all output links are used, and the values of
If SELM is C<All>, then all output links are used, and the values of
SELL and SELN are ignored.
If SELM=="Specified", then the value of SELN is used to specify a single
If SELM is C<Specified>, then the value of SELN is used to specify a single
link which will be used. If SELN==0, then no link will be used; if SELN==1,
then OUTA will be used, and so on.
SELN can either have its value set directly, or have its values retrieved
from another EPICS PV. If SELL is a valid PV link, then SELN will be set to
the values of the linked PV.
SELN can either have its value set directly, or have it retrieved from
another EPICS PV. If SELL is a valid PV link, then SELN will be read from
the linked PV.
If SELM=="Mask", then SELN will be treated as a bit mask. If bit one of
SELN is set, then OUTA will be used, if bit two is set, OUTB will be used.
Thus if SELN==5, OUTC and OUTA will be used.
If SELM is C<Mask>, then SELN will be treated as a bit mask. If bit zero
(the LSB) of SELN is set, then OUTA will be written to; if bit one is set,
OUTB will be written to, and so on. Thus when SELN==5, both OUTC and OUTA
will be written to.
=fields OUTA, OUTB, OUTC, OUTD, OUTE, OUTF, OUTG, OUTH
=fields SELL, SELM, SELN, OUTA, OUTB, OUTC, OUTD, OUTE, OUTF, OUTG, OUTH
=head3 Operator Display Parameters

View File

@@ -2,6 +2,7 @@
#*************************************************************************
# Copyright (c) 2018 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# SPDX-License-Identifier: EPICS
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
@@ -34,6 +35,8 @@ sub HostArch {
return 'linux-x86_64' if m/^x86_64-linux/;
return 'linux-x86' if m/^i[3-6]86-linux/;
return 'linux-arm' if m/^arm-linux/;
return 'linux-aarch64' if m/^aarch64-linux/;
return 'linux-ppc64' if m/^powerpc64-linux/;
return 'windows-x64' if m/^MSWin32-x64/;
return 'win32-x86' if m/^MSWin32-x86/;
return "cygwin-x86_64" if m/^x86_64-cygwin/;
@@ -44,8 +47,8 @@ sub HostArch {
my ($kernel, $hostname, $release, $version, $cpu) = uname;
if (m/^darwin/) {
for ($cpu) {
return 'darwin-x86' if m/^(i386|x86_64)/;
return 'darwin-ppc' if m/Power Macintosh/;
return 'darwin-x86' if m/^x86_64/;
return 'darwin-aarch64' if m/^arm64/;
}
die "$0: macOS CPU type '$cpu' not recognized\n";
}