Commit Graph

3226 Commits

Author SHA1 Message Date
Andrew Johnson
ab78480d54 Merged spinlockfix branch.
Some last-minute fixes for VxWorks build warnings.
2014-07-31 12:45:40 -05:00
Andrew Johnson
68bcc77885 Merged alarm-strings branch. 2014-07-31 10:17:24 -05:00
Andrew Johnson
b3afbea7cf Merged Michael's thread-pool branch.
Made various formatting changes, and fixed one problem in the
test program which failed a test on UP machines.
2014-07-29 16:05:24 -05:00
Michael Davidsaver
716f2679a7 thread pool: don't use reserved names
Avoid global symbols with leading underscore
2014-07-29 12:21:07 -04:00
Michael Davidsaver
b1a8b2f20e thread pool: switch thread counts to unsigned int
size_t is considered overly optimistic
2014-07-29 12:18:19 -04:00
Michael Davidsaver
6fee83900e don't include errCommon.h
doesn't exist anymore
2014-07-29 12:06:24 -04:00
Michael Davidsaver
c4a1208d6e epicsSpinTest: add to libCom test harness 2014-07-25 18:17:27 -04:00
Michael Davidsaver
9cb65e5408 epicsSpinTest: plug some leaks 2014-07-25 18:17:02 -04:00
Andrew Johnson
2a9d05248f Fix epicsSpinTest.c spinThread tests
Runs many more rounds, without blocking with the lock held.
2014-07-25 16:21:03 -05:00
Andrew Johnson
752549d1c8 Fix epicsAtomic headers when used from C code
Several C++ and C99-isms crept in.
2014-07-25 15:05:58 -05:00
Michael Davidsaver
8fec9d6e00 epicsSpin: try lock return non-blocking
Avoid cantProceed() in try lock, even for undefined behavior.
2014-07-25 15:12:02 -04:00
Michael Davidsaver
5824f98972 epicsSpinTest: fix verifyTryLock()
avoid sleeping with a spinlock held.
Now test only works on SMP systems.
2014-07-25 15:11:54 -04:00
Michael Davidsaver
95b916ecd4 thread pool: mark epicsJobCreate() as safe for job functions
Also, use epicsJobMove() to avoid some redundant code
2014-07-25 10:16:20 -04:00
Michael Davidsaver
cbfbce54f9 thread pool: epicsThreadPoolWait return ETIMEOUT 2014-07-25 09:59:46 -04:00
Michael Davidsaver
b3a1fe9c6b thread pool: fix return of epicsJobUnqueue()
Return 0 on success (was queued, now is not),
1 if not queued initially, and EINVAL
if orphaned.
2014-07-24 18:56:27 -04:00
Michael Davidsaver
83dfc7980d thread pool: handle failure to create worker
epicsJobQueue() returns EAGAIN when the first worker
can't be lazily created.

Failure to create workers beyond the first is
silently ignored.
2014-07-24 18:50:19 -04:00
Michael Davidsaver
69d1063067 thread pool: epicsJobQueue return EPERM
When pool control prevents operation
2014-07-24 18:19:33 -04:00
Andrew Johnson
9b6e270b97 Final spinlock tidying-up
* Abort epicsSpinTest() if epicsSpinCreate() returns NULL
* Adjust RELEASE_NOTES that describe the implementations.
2014-07-24 16:33:35 -05:00
Michael Davidsaver
fc4119094f thread pool: epicsThreadPoolGetShared accepts NULL as defaults 2014-07-24 14:44:28 -04:00
Michael Davidsaver
01a50b5165 thread pool test 2014-07-24 14:22:52 -04:00
Michael Davidsaver
658bd0b570 thread pool implementation 2014-07-24 14:22:52 -04:00
Michael Davidsaver
a8fd14aae1 Thread pool API 2014-07-24 14:22:52 -04:00
Michael Davidsaver
87a6688c17 epicsSpin: remove redundant cantProceed() messages 2014-07-24 10:23:55 -04:00
Michael Davidsaver
3ba5bf943e epicsSpin: better error messages when mis-use is detected 2014-07-23 18:40:08 -04:00
Andrew Johnson
6bdb8f911a Suppress errlog output of expected warning messages. 2014-07-23 16:18:32 -05:00
Andrew Johnson
3ff49fc9b2 Fixed build errors, remove dependency on std.
Build errors: Include guard missing from epicsUnitTest.h;
    dbShutdownTest.c was calling the non-universal strcasecmp()
    instead of epicsStrCaseCmp().

ioc/db/test no longer depends on std. I modified
    xRecord to make it a working record type, and simplified the
    other test programs so they all use the same new expanded
    dbd file rather than each making their own. I also added
    dbShutdownTest() to epicsRunDbTests().
2014-07-10 14:27:44 -05:00
Andrew Johnson
60a0c7f181 Make epicsExit subsystem reusable.
Calling epicsAtExit() after epicsExitCallAtExits() now
recreates the per-process list and registers the routine.
2014-06-23 16:28:25 -04:00
Michael Davidsaver
3ca42fc838 cleanup iocsh 2014-06-23 16:28:22 -04:00
Michael Davidsaver
ad2bb0725d asShutdown 2014-06-23 16:28:22 -04:00
Michael Davidsaver
f405b444a3 errlog: nicer exit handler name 2014-06-23 16:28:19 -04:00
Michael Davidsaver
a28a561d8a epicsExit: optional debug printing
Add a flag to cause a string to be printed
before each handler is run to show the order.
2014-06-23 16:28:18 -04:00
Andrew Johnson
9e1ebf8d0f Clean up build warnings from Darwin (clang). 2014-05-30 12:36:50 -05:00
Michael Davidsaver
80b64d6a30 spinlocks update
add epicsSpinMustCreate()

Fix spinlock on RTEMS and vxWorks
UP systems to disable task preemption.

Don't use posix spinlocks when
thread priorities are used.
2014-05-23 15:14:49 -04:00
Andrew Johnson
7dd5e217f6 Merged Ralph's get-cpus branch. 2014-05-19 09:44:05 -05:00
Ralph Lange
722d5eeba7 libCom/osi: use epicsThreadGetCPUs implementation from thread-pool branch (posix, WIN32) 2014-05-18 17:24:38 +02:00
Andrew Johnson
f24dafa1e0 libCom: Adjust the Posix epicsMutexOSD structure
Make pthread_mutex_t lock the first member of the
parent structure, so it's easy to convert between them.
2014-04-01 11:09:36 -05:00
Andrew Johnson
4b18edc586 Merged changes from 3.14 branch.
Up to revno 12479.
2014-03-13 15:04:31 -05:00
Andrew Johnson
f5b9db9583 libCom: Fix epicsString.h comparison functions
The string comparison functions epicsStrCaseCmp() and
epicsStrnCaseCmp() were returning incorrect results
when the strings did not match.

These functions now match their BSD equivalents, and
have working tests to confirm their operation.
2014-03-11 17:12:41 -05:00
Andrew Johnson
5bdd9ddca6 Windows: Fix static builds on MinGW
Xiaoqiang Wang proposed some fixes that allow static builds on
the MinGW targets to succeed. Some additional changes made to
blockingSockTest.cpp also clean that up.
2014-02-25 15:56:13 -06:00
Andrew Johnson
0dc2746d68 libCom: Added echo command to iocsh 2014-02-21 15:49:15 -06:00
Andrew Johnson
1a70f1e347 libCom: Added macro EPICS_UNUSED to compilerDependencies.h
Stop unnecessary warnings.
2014-02-20 18:05:42 -06:00
Andrew Johnson
3fd8d4515c libCom/test: Finish converting blockingSockTest to epicsUnitTest
Don't call assert() from a test program,
it stops the tests from running if the assert fails.
2014-02-20 16:36:58 -06:00
a3354f5db9 libCom: NTP Time Provider adjusts to OS tick rate changes
Allow the NTP Time provider (used on VxWorks and RTEMS only)
to adapt to changes in the OS clock tick rate after the provider
has been initialized.

Changing the tick rate after iocInit() is not advisable,
other software might still misbehave if initialized before
an OS tick rate change.
2014-02-13 10:09:12 -06:00
Andrew Johnson
e1e389a2dd Low-memory behaviour fixes.
Fix unchecked buffer allocation in dbChannel.c
Replace calls to epicsStrDup() with checked malloc() for
things that happen often after iocInit.

Michael Davidsaver pointed out this issue.
2014-02-07 17:19:28 -06:00
Andrew Johnson
502366fdc3 epicsMutex C++ API: New constructor and newEpicsMutex macro
The new constructor accepts source file & line number.
The macro passes these in.
2014-02-07 14:13:12 -06:00
Andrew Johnson
b32127c5de libCom: Fix epicsTime::strftime() roll-over bug
Fractional seconds could round-up to .000 without
incrementing the integer seconds.
We can't actually do the latter, so we prevent the
roll-over and clamp at all 9's instead.
Idea from Eric Norum.
2014-01-29 16:52:22 -06:00
Andrew Johnson
dbb8d232ee libCom/test: Losen the timer error threshold.
Windows was consistently failing the fastest timer tests.
2013-12-17 17:13:27 -06:00
unknown
b93601bc22 libCom/test: epicsStrGlobMatch() tests 2013-12-17 16:37:46 -06:00
Andrew Johnson
9e37ab649b libCom: Clear up warnings from VxWorks 6.9. 2013-12-17 14:19:18 -06:00
Andrew Johnson
0a2020e2fc Merged changes from 3.14 branch
Up to 3.14.12.4 release.
2013-12-17 12:54:04 -06:00