Commit Graph

892 Commits

Author SHA1 Message Date
4e8b3326a5 Fix MSVC warning C4101
unreferenced local variable

In this case: exceptions caught but never used.
No need to give them a variable name.
2025-11-06 08:18:16 -08:00
1b65309ec9 Fix MSVC warning C4275
non - DLL-interface class 'class_1' used as base for DLL-interface class 'class_2'
2025-11-05 09:11:51 -08:00
95872d9aad Fix MSVC warning C4390
';' : empty controlled statement found; is this the intent?
2025-11-05 09:09:12 -08:00
b4557d6a5a Fix MSVC warning C4309
truncation of constant value

The value 0xFFFF does not fit a signed 16 bit integer.
Use -1 instead.
2025-11-05 08:49:55 -08:00
Jeremy Lorelli
a97ac50b01 Fix printf format warning 2025-05-05 10:09:14 -07:00
Michael Davidsaver
cf483d664d Set PVAS_SERVER_PORT 2023-11-01 09:47:39 -05:00
Freddie Akeroyd
55ab0fd3b8 Avoid data() as it is c++11 2023-11-01 09:44:21 -05:00
Freddie Akeroyd
d4bb5952a4 Fix crash when toEcho empty 2023-11-01 09:44:21 -05:00
Andrew Johnson
b2f0aecfa3 Merge my use-tsDLList branch, PR#176 2022-02-22 12:58:54 -06:00
Xiaoqiang Wang
9544171233 avoid dangling pointer when indexvalue does out of scope 2022-02-19 20:49:09 +01:00
c63d0731bf use std::showbase instead of literal 0x 2021-11-19 12:13:34 -08:00
ec85ffc3d0 reset ostream flags when done 2021-11-19 12:13:34 -08:00
Andrew Johnson
3a20a064e5 CAProvider: Fix cleanup during provider destruction
CAChannel's channelProvider pointers have all expired by
now, so the destructor must empty caChannelList itself.
2021-10-21 14:23:40 -05:00
Andrew Johnson
c44f90fd49 CAChannel: Prevent problems during cleanup
Guard channelCreated with requestsMutex.
Remove channel from provider before clearing channelCreated.
Simplify status handling.
2021-10-21 13:07:14 -05:00
Andrew Johnson
8cbd48faf3 Clean up CAChannel (done in disconnectChannel()) 2021-10-20 20:07:50 -05:00
Andrew Johnson
b8979b4152 Reject empty channel names 2021-10-20 20:06:55 -05:00
Andrew Johnson
ace1a82c12 caProvider: Convert caChannelList into a tsDLList
This should provide a significant performance boost when creating
many thousands of CA channels. The only time it is necessary to
traverse the list is in the CAChannelProvider's destructor; when
individual channels are added or destroyed they can insert or
remove themselves from the list without having to do a search.
2021-10-20 20:06:28 -05:00
Andrew Johnson
99432d6809 caProvider: Minor cleanup 2021-10-01 09:54:48 -05:00
Andrew Johnson
161eac3a38 caProvider: speed up monitor list handling
Not a major speed-up since the list of monitors is per-channel,
but using wptr::expired() is more efficient than wptr::lock().
2021-10-01 09:54:14 -05:00
Andrew Johnson
671f5a406c caProvider: Speed up addChannel()
Use wptr::expired() instead of wptr::lock() for testing if the
shared pointer is still valid, *much* faster!
Also switched from index to interator, but that's incidental.
2021-10-01 09:32:11 -05:00
Andrew Johnson
7240f97e76 Fix error string in ca/dbdToPv.cpp 2021-09-17 11:51:23 -05:00
Sinisa Veseli
cd152c37a4 add checks for null pointers 2021-08-10 11:11:59 -05:00
Sinisa Veseli
9a88e5e879 fix issue with null pointer check for DBR_ENUM 2021-08-04 11:19:47 -05:00
Sinisa Veseli
deefe12491 avoid probleem with pv structures that do not have value subfield 2021-07-28 23:33:01 -05:00
Michael Davidsaver
2702e60937 increase TCP timeout to 40 seconds 2021-01-14 18:15:30 -08:00
Andrew Johnson
4638c11c8c Fix for 3.15 DLL builds 2021-01-05 11:01:02 -08:00
Andrew Johnson
7910f7a794 Another include epicsGuard.h missing for 3.15 builds 2021-01-05 11:01:02 -08:00
Andrew Johnson
62cbbd6722 caChannel: Use epicsMutex and epicsGuard<> 2021-01-05 11:01:02 -08:00
Andrew Johnson
ece8b94357 include epicsGuard.h for 3.15 builds 2021-01-05 11:01:02 -08:00
Andrew Johnson
bf04c69bda Conveyor: Don't try to support self-deletion 2021-01-05 11:01:02 -08:00
Andrew Johnson
e0c2496e52 Add a Notification constructor that also sets client 2021-01-05 11:01:02 -08:00
Andrew Johnson
e00ccbeb9c Conveyor: Change run() to follow MAD's skeleton
This is still broken if a client method (notify() or the destructor)
deletes the conveyor, which accesses data members before exiting.
2021-01-05 11:01:02 -08:00
Andrew Johnson
a9725834dc Add tests for notifyConveyor 2021-01-05 11:01:02 -08:00
Andrew Johnson
a078e03041 Notifyer: Give conveyor threads a unique name 2021-01-05 11:01:02 -08:00
Andrew Johnson
98e81a542e Use epicsMutex and epicsEvent instead of pv::data equivalents 2021-01-05 11:01:02 -08:00
Andrew Johnson
0332d0f2c1 notifierConveyer destruction protection
Remove the work variable
2021-01-05 11:01:02 -08:00
Andrew Johnson
345f2782cd caContext: Restore existing context in constructor
Don't assume other code might be using our context.
Fix destructor to reattach the right context.
2021-01-05 11:01:02 -08:00
Andrew Johnson
b0b2228558 Make ca::Attach::context a reference, not a smart pointer 2021-01-05 11:01:02 -08:00
Andrew Johnson
92002b6ba2 Include pvAccess.h before exportSharedSym's in caContext.cpp 2021-01-05 11:01:02 -08:00
Andrew Johnson
33cc9b1fdb Define epicsExportSharedSymbols in ca/notifierConveyor.cpp 2021-01-05 11:01:02 -08:00
Andrew Johnson
8b3a057a69 Have notifierConveyor trap and drop any exceptions 2021-01-05 11:01:02 -08:00
Andrew Johnson
f9c40e96cf Collect ca_client_context operations
Each instance of the caContext class represents a separate CA context,
so each CAChannelProvider creates one and keeps a shared_ptr to it,
making that available to its channels and channel operations. These
also take their own shared_ptr to it as well so the context cannot be
destroyed while it might be needed.

A related caContext Attach object is intended to be short-lived, and
to be allocated on the stack. When created it saves the current CA
context for the thread, replacing it from the caContext given to its
constructor. CA operations will now use the attached context. When the
Attach destructor runs it detaches the thread from the current context
(checking still has the expected value) and re-attaches the thread to
any context that was saved by the constructor.
2021-01-05 11:01:02 -08:00
Andrew Johnson
25dde0f4ba Make Codacy happier 2021-01-05 11:01:02 -08:00
Andrew Johnson
06c2fb579f Replaced 4 notification threads with 2 notifierConveyors
Channel connection notifications are now handled by connectNotifier,
getDone, putDone and monitor events handled by resultNotifier.
A notifierConveyor is generic, and contains a queue and a thread.
You pass a Notification pointing to a NotifierClient to a Conveyor's
notifyClient() method, and the thread will call the client's
notifyClient() method once it reaches the front of the queue.

The conveyor threads stop when the caProvider is destroyed.
The queue stores weak pointers, so queued notifications won't prevent
client objects from being destroyed.
2021-01-05 11:01:02 -08:00
Andrew Johnson
2729903a10 Make the channelConnectThread per-provider
This passes the tests (on MacOS).
2021-01-05 11:01:02 -08:00
Andrew Johnson
601280836d Move caProvider worker threads shutdown to static destructors 2021-01-05 11:01:02 -08:00
Andrew Johnson
44fda51935 Start of major overhaul
Moved duplicated EXCEPTION_GUARD macro to private header file.
Removed all DEBUG_LEVEL and similar prints.
Some reformatting and code simplification.
2021-01-05 11:01:02 -08:00
Andrew Johnson
9671ee132e caProvider threads: Lock the mutex while reading isStop state 2021-01-05 11:01:02 -08:00
Michael Davidsaver
d005260017 hackAroundRTEMSSocketInterrupt 2020-11-22 11:58:33 -08:00
Michael Davidsaver
fc4e3c5d44 discoverInterfaces() correctly ignore non-IPv4 addresses
Must check sa_family early, before attempting to copy
in case sockaddr needs more storage than sockaddr_in.
2020-11-21 10:32:18 -08:00