Merge lp:~johill-lanl/epics-base/epicsThreadOnce-atomics-based into lp:~epics-core/epics-base/3.15
Status: | Rejected |
---|---|
Rejected by: | Andrew Johnson |
Proposed branch: | lp:~johill-lanl/epics-base/epicsThreadOnce-atomics-based |
Merge into: | lp:~epics-core/epics-base/3.15 |
Prerequisite: | lp:~epics-core/epics-base/epicsR3.15-atomics |
Diff against target: |
435 lines (+132/-166) (has conflicts) 8 files modified
src/libCom/Makefile (+1/-0) src/libCom/misc/ipAddrToAsciiAsynchronous.cpp (+1/-1) src/libCom/osi/epicsThread.h (+1/-1) src/libCom/osi/epicsThreadOnce.cpp (+129/-0) src/libCom/osi/os/RTEMS/osdThread.c (+0/-32) src/libCom/osi/os/WIN32/osdThread.c (+0/-35) src/libCom/osi/os/posix/osdThread.c (+0/-44) src/libCom/osi/os/vxWorks/osdThread.c (+0/-53) Text conflict in src/libCom/Makefile |
To merge this branch: | bzr merge lp:~johill-lanl/epics-base/epicsThreadOnce-atomics-based |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Johnson | Needs Fixing | ||
Review via email: mp+73606@code.launchpad.net |
This proposal supersedes a proposal from 2011-08-31.
Description of the change
o added new epicsAtomics based, and OS independent, implementation of epicsThreadOnce in epicsThreadOnce.cpp
o changed type of epicsThreadOnceId from epicsThreadId to void *
o fixed once flag isnt initialized with EPICSTHREAD_
o removed OS dependent implementations of epicsThreadOnce from {posix, RTEMS, vxWorks, win32}
Unmerged revisions
- 12261. By Jeff Hill
-
fixed spelling in comment
- 12260. By Jeff Hill
-
o moved epicsThreadOnce impl details to anonymous namespace
o fixed recursion sanity test is too agressive
o added some comments - 12259. By Jeff Hill
-
o added new epicsAtomics based, and OS independent, implementation of epicsThreadOnce in epicsThreadOnce.cpp
o changed type of epicsThreadOnceId from epicsThreadId to void *
o fixed once flag isnt initialized with EPICSTHREAD_ONCE_INIT in ipAddrToAsciiAs ynchronous. cpp
o removed OS dependent implementations of epicsThreadOnce from {posix, RTEMS, vxWorks, win32} - 12258. By Jeff Hill <email address hidden>
-
fixed names on redefinition protection macros for vxWorks
- 12257. By Jeff Hill
-
fixed epics atomic read memory barrier name - old versions of vxWorks
- 12256. By Jeff Hill
-
fixed word missing from vxWorks specific read and write memory barrier functions
- 12255. By Jeff Hill <email address hidden>
-
fixed vxWorks name for epicsAtomicTest
- 12254. By Jeff Hill <email address hidden>
-
fixed wrong return type old vxWorks epicsAtomicUnlock
- 12253. By Jeff Hill
-
fixed test count
- 12252. By Jeff Hill
-
fixed vxWorks jumbled ifdef
Hi Jeff,
The epicsThreadOnce.cpp file has an essential function epicsThreadOnce Only() which calls cantProceed(), epicsThreadSleep() and errlogPrintf() [the cantProceed() function also calls both of the other two]. Unfortunately both the errlog and generalTime facilities rely on epicsThreadOnce during initialization, thus this implementation could be subject to circular startup problems.
When I try to boot an IOC on vxWorks 6.8 with this code, it hangs silently while executing the C++ static constructors.
If I replace the errlogPrintf() call with std::printf(), after maybe a 10 second delay waiting for the vxWorks munch file to finish loading I get the message "epicsThreadOnce: waiting for another thread to finish calling the once function" which then repeats forever. Here's the stack of the thread loading the munch file:
0x00206b2c ld +0xb4 : usrModuleLoad () _I_iocshPpdbbas e () _I_iocshPpdbbas e+0x28 : 0x010b2ae8 () 0x210: iocshRegister () +0xfc : 0x010c59bc (0x8000003c) p+0x8c : taskDelay ()
0x002069e0 usrModuleLoad+0x1c : loadModule ()
0x001da4c0 loadModule +0x24 : loadModuleAt ()
0x001da3d4 loadModuleAt +0xe0 : 0x001da02c ()
0x001da198 loadLibInit +0x21c: cplusLoadFixup ()
0x002141a4 cplusLoadFixup+0x8c : cplusCallCtors ()
0x00143594 cplusCallCtors+0x28 : _GLOBAL_
0x010b2bc8 _GLOBAL_
0x010b2b44 iocshRegister+
0x010b2978 iocshRegister+0x44 : 0x010b0d40 ()
0x010b0d70 gphInitPvt +0x16c: epicsThreadOnce ()
0x010bdfc4 epicsThreadOnce
0x010c5a44 epicsThreadSlee
I suspect it may not be possible to fix this in a generic, portable fashion. The current implementations of epicsThreadOnce() are all OS-specific and understand the OS-specific startup requirements. However I'd be happy to test a revised version if you manage to get it working properly on vxWorks.
- Andrew