Commit Graph

3668 Commits

Author SHA1 Message Date
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
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
Freddie Akeroyd
e8c5748f89 Use <osiSock.h> rather than <osdSock.h> 2021-06-25 11:37:07 +01:00
Freddie Akeroyd
d1ddbad053 Fix issue with very large timeout passed to epicsEventWaitWithTimeout()
A very large timeout was getting converted to a 0 wait and causing
some unit tests to fail in strange and random ways. Not trapping
large timeouts was an oversight when converting to waitable timers
on WIN32
2021-05-19 08:46:11 -07:00
Andrew Johnson
b55c019f10 Merged Freddie's waitable_timers branch into 3.15 2021-05-05 17:55:00 -05:00
Andrew Johnson
d831c2b384 Merge 'FreddieAkeroyd-use_epicsStrtod' into 3.15 2021-03-11 20:18:57 -06:00
Freddie Akeroyd
3c7fb7990f Use <epicsStdlib.h> 2021-03-11 15:08:00 +00:00
Freddie Akeroyd
c140a0a804 Add additional cleanup and error handling 2021-03-10 21:58:35 +00:00
Freddie Akeroyd
8e7702c8a5 Use epicsStrtod, remove some warnings 2021-03-10 11:29:45 +00:00
Freddie Akeroyd
5f94ab6d9f Tidy up 2021-03-10 10:47:24 +00:00
Freddie Akeroyd
c6af4a245d Use waitable timers 2021-03-10 01:17:47 +00:00
Jack Harper
30172226f9 whoops, MSVC 1900 not 1800 2021-03-09 13:13:16 +00:00
Jack Harper
2ea0994507 tests passing 2021-03-09 13:04:57 +00:00
Andrew Johnson
a8036d7f34 posix/osdThread: Use "Once" versions properly
Functions used before epicsThreadInit() returns must call the
checkStatusOnceQuit() version to avoid recursion from errlogInit()
2020-12-23 11:53:05 -06:00
Andrew Johnson
a365de2419 Fix return value of epicsUnitTest::testDone()
Wasn't properly returning a non-zero exit status
when HARNESS_ACTIVE was set.
2020-12-17 18:21:07 -06:00
Ralph Lange
0fbfc74182 Fix missing deletion in 97b29129 from 'fix/misc'
- fixes 97b29129 that was replacing two assert() statements
  without removing the original (offending) lines
2020-06-23 11:23:57 +02:00
Ralph Lange
92374b2be2 libcom/osi: fix potential leak in vxWorks/osdThread.c
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
579fc9d0c7 libcom/osi: fix potential leak in default/osdThreadHooks.c
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
cd47bbf99b libcom/osi: fix debug printf() in default/osdNetIntf.c
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
d3d40689c8 libcom/osi: fix dangerous usage of strncat (WIN32)
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
d5eb055bb7 libcom/flex: fix sscanf() argument types
(code smell found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
97b29129af libcom/test: don't modify operand in assert() statement
(code smell found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Andrew Johnson
732f8b19be Merge branch 'defaultMessageQueue' into 3.15 2020-05-14 10:41:52 -05:00
Andrew Johnson
b03e2f376b eMQTest: Start each test with a new (empty) queue
If fastReceiver() took more than 0.01 seconds to exit,
sleepySender() might have pushed a second message onto
the queue after setting recvExit, so there would be an
extra message in the queue for the next test, which I
was seeing on Appveyor. That's my current theory...
2020-05-13 16:11:31 -05:00
Andrew Johnson
59c68807b6 Heinz Junkes' fix for lp: #1812084 Build failure on RTEMS
I reduced some of the code duplication from his original.
2020-05-13 15:26:34 -05:00
Andrew Johnson
2e7ed02a60 Allow/expect MinGW to fail epicsStackTraceTest #5 2020-05-07 13:13:26 -05:00
Andrew Johnson
089954aaab MessageQueue Tests: Extend Mark's sleep tests 2020-05-07 13:12:12 -05:00
Andrew Johnson
34e0b2f305 osdMessageQueue: Undo change to -ve timeout handling
The internal mySend() and myReceive() routines do expect a timeout
of -1 to mean wait forever, see the epicsMessageQueueSend() and
epicsMessageQueueReceive() API routines.
2020-05-04 11:56:14 -05:00
Andrew Johnson
ceb13797a6 Cosmetic 2020-05-01 00:13:02 -05:00
Andrew Johnson
084557bd3e osdMessageQueue: Don't wake our sender until we're ready for it
Move the code that wakes up the next sending task to after we've
added our threadNode to the receiveQueue. He still has to wait for
us to release the Mutex though, so this might make no difference.
This commit also changes when we decrement the number of waiting
senders so it always happens immediately after a threadNode gets
taken off the sendQueue by the code that removed it.
2020-05-01 00:12:32 -05:00
Andrew Johnson
aeed7cfbdd osdMessageQueue: This is the mirror of Heinz Junkes' earlier fix
When sending a message, if the queue is full so we have to wait, we
create a threadNode with an eventNode in it and stick it on the
sendQueue, then wait for a receiver to signal that event, waking us.
If we awoke due to a timeout but a receiver was actually waking us
up anyway (i.e. eventSent was set), we shouldn't give up.
2020-04-30 23:55:30 -05:00
Andrew Johnson
183c3b2a3e osdMessageQueue: Clear eventNode before returning it
Introduced freeEventNode() which ensures eventNodes don't have a
signalled event in them before returning the node to the freeList.
Callers pass the status from epicsEventWaitWithTimeout() to indicate
whether it was signalled or not. If it timed out we must trigger it
and Wait to clear the event state.
2020-04-30 23:38:51 -05:00
Andrew Johnson
cf2fef2405 osdMessageQueue: Return sooner on -ve timeout
It appears that previously a negative timeout actually implemented a
'wait forever', but the VxWorks and RTEMS implementations both check
for (timeout <= 0) and return immediately if nothing can be done
without waiting.
2020-04-30 23:27:43 -05:00
Andrew Johnson
298c8706ec osdMessageQueue: Rename freeEventNode() -> destroyEventNode() 2020-04-30 22:59:58 -05:00
Andrew Johnson
841effe9ee epicsMessageQueueTest: Shorten the 1R4S tests 2020-04-16 17:14:58 -05:00
Andrew Johnson
a9727fd5cb Ben Franksen's fix for lp: #1868486 2020-04-16 17:12:25 -05:00
Andrew Johnson
fde0485d6b Added Mark Rivers' tests for the message queue timeout bug 2020-04-16 17:10:53 -05:00
Andrew Johnson
a95635a018 Merge Freddie's bit_operations branch into 3.15 2020-04-14 15:28:22 -05:00
Andrew Johnson
9df39475cd Merge Martin Konrad's fix-log-issues branch into 3.15 2020-04-14 11:41:23 -05:00
Andrew Johnson
38339b6ccf Initialize main thread as OkToBlock 2020-04-13 17:56:09 -05:00
Andrew Johnson
b2160bd618 Merge Martin Konrad's replace-usleep branch into 3.15 2020-03-20 13:40:35 -05:00
Andrew Johnson
a9034bb586 Fix clock_gettime issue on newer MinGW builds
Fixes lp: #1853168
2020-03-07 00:40:13 -06:00
Martin Konrad
f9820577c1 Replace usleep call by nanosleep
Also improve behavior in case signals are delivered to the sleeping
thread. This fixes a potential security weakness reported by codacy
(interaction of usleep with SIGALRM and other timer functions such
as sleep(), alarm(), setitimer(), and nanosleep() is unspecified).
2020-03-04 11:19:02 -05:00
Michael Davidsaver
e6914f3b80 osdSockUnsentCount.c check for existance of SIO_TCP_INFO 2020-02-20 15:37:18 -05:00
Freddie Akeroyd
3944b32e04 Add back in optimisation disable 2020-02-17 13:30:15 +00:00
Freddie Akeroyd
a0667a122b Excluded x64 tests now need to be excluded on x86 too 2020-02-17 13:29:38 +00:00
Freddie Akeroyd
803593560d Remove redundant left logical shift 2020-02-17 12:22:20 +00:00