Threaded version 0.7

This commit is contained in:
2026-10-06 23:50:07 -06:00
parent 490c9bdc5b
commit c39c226885
15 changed files with 13126 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
# Export import correction
The Worker object in the first threaded export contained an unnamed List element.
The generator cleared its attributes as well as its children. This revision
restores Name="ChildObjectGuids", preserves an empty child list, and matches the
original export envelope (no XML declaration, CRLF line endings).
All collection elements now retain serialization attributes. XML parsing passes.
CODESYS import has not been verified in an IDE. If import still fails, capture the
exact error text and whether it occurs before or after the object selection dialog.
The C sources and IEC program logic are unchanged by this correction.
+90
View File
@@ -0,0 +1,90 @@
{
"NATIVE_CMD_ACKNOWLEDGE": "CMD_ACKNOWLEDGE",
"NATIVE_CMD_CLOSE": "CMD_CLOSE",
"NATIVE_CMD_CONFIGURE": "CMD_CONFIGURE",
"NATIVE_CMD_COPY_READ": "CMD_COPY_READ",
"NATIVE_CMD_ENABLE": "CMD_ENABLE",
"NATIVE_CMD_OPEN": "CMD_OPEN",
"NATIVE_CMD_REQUEST_TIMEOUT": "CMD_REQUEST_TIMEOUT",
"NATIVE_CMD_SUBMIT": "CMD_SUBMIT",
"NATIVE_CMD_TICK": "CMD_TICK",
"NATIVE_ERROR_CANCELLED": "ERROR_CANCELLED",
"NATIVE_ERROR_INVALID_HANDLE": "ERROR_INVALID_HANDLE",
"NATIVE_STATE_DISABLED": "STATE_DISABLED",
"NATIVE_STATE_READY": "STATE_READY",
"NATIVE_STATE_RECEIVING": "STATE_RECEIVING",
"NATIVE_STATUS_DONE": "STATUS_DONE",
"NATIVE_STATUS_ERROR": "STATUS_ERROR",
"NATIVE_STATUS_EXCEPTION": "STATUS_EXCEPTION",
"NATIVE_STATUS_FUNCTION": "STATUS_FUNCTION",
"NATIVE_STATUS_HANDLE": "STATUS_HANDLE",
"NATIVE_STATUS_LAST_ERROR": "STATUS_LAST_ERROR",
"NATIVE_STATUS_RECONNECTS": "STATUS_RECONNECTS",
"NATIVE_STATUS_RESULT": "STATUS_RESULT",
"NATIVE_STATUS_SOCKET_ERROR": "STATUS_SOCKET_ERROR",
"NATIVE_STATUS_STATE": "STATUS_STATE",
"NATIVE_STATUS_WRITE_UNCERTAIN": "STATUS_WRITE_UNCERTAIN",
"invalidateNativeData": "invalidateData",
"nativeActiveIndex": "engineActiveIndex",
"nativeActiveRequest": "engineActiveRequest",
"nativeArgAddress": "engineArgAddress",
"nativeArgFunction": "engineArgFunction",
"nativeArgQuantity": "engineArgQuantity",
"nativeArgTimeout": "engineArgTimeout",
"nativeArgUnit": "engineArgUnit",
"nativeCall": "callEngine",
"nativeCallResult": "engineCallResult",
"nativeConfigConnect": "engineConfigConnect",
"nativeConfigRetry": "engineConfigRetry",
"nativeConnectTimeoutMilliseconds": "engineConnectTimeoutMilliseconds",
"nativeCopyAllowed": "engineCopyAllowed",
"nativeCycle": "processCycle",
"nativeDataIndex": "engineDataIndex",
"nativeDevice": "engineDevice",
"nativeEnable": "engineEnable",
"nativeEndpointIP": "engineEndpointIP",
"nativeEndpointPort": "engineEndpointPort",
"nativeEnsureContext": "ensureContext",
"nativeFinish": "finishRequest",
"nativeFinishedIndex": "engineFinishedIndex",
"nativeFunction": "engineFunction",
"nativeHandle": "engineHandle",
"nativeHoldUncertainWrites": "engineHoldUncertainWrites",
"nativeIO": "engineIO",
"nativeIP": "engineIP",
"nativeInFlight": "engineInFlight",
"nativeLastSuccessMs": "engineLastSuccessMs",
"nativeMode": "engineMode",
"nativeNowMicroseconds": "engineNowMicroseconds",
"nativeNowMilliseconds": "engineNowMilliseconds",
"nativeOpenCommand": "engineOpenCommand",
"nativePort": "enginePort",
"nativeProcess": "processTransaction",
"nativeReadComplete": "engineReadComplete",
"nativeRelease": "releaseContext",
"nativeReplied": "engineReplied",
"nativeRequestStartMilliseconds": "engineRequestStartMilliseconds",
"nativeResponseSeen": "engineResponseSeen",
"nativeResultReady": "engineResultReady",
"nativeRetryDelayMilliseconds": "engineRetryDelayMilliseconds",
"nativeSelectNextRequest": "selectNextRequest",
"nativeSelected": "engineSelected",
"nativeSent": "engineSent",
"nativeSerialBaud": "engineSerialBaud",
"nativeSerialBits": "engineSerialBits",
"nativeSerialParity": "engineSerialParity",
"nativeSerialRs485": "engineSerialRs485",
"nativeSerialStops": "engineSerialStops",
"nativeStatus": "engineStatus",
"nativeTransactionDataIndex": "engineTransactionDataIndex",
"nativeTransactionQuantity": "engineTransactionQuantity",
"nativeUpdateDiagnostics": "updateDiagnostics",
"nativeUpdateStatistics": "updateStatistics",
"nativeWasConnected": "engineWasConnected",
"nativeWindowCount": "engineWindowCount",
"nativeWindowStartMilliseconds": "engineWindowStartMilliseconds",
"nativeWindowTime": "engineWindowTime",
"nativeWriteHold": "engineWriteHold",
"out_lastNativeError": "out_lastErrorCode",
"out_nativeError": "out_errorCode"
}
+37
View File
@@ -0,0 +1,37 @@
# Worker ABI and lifecycle
The 16-argument atMbCall_cext ABI and its signature are retained. Calls are serialized
by the lifecycle mutex and priority-inheritance engine mutex. The worker accesses
fixed C contexts only. Calls may wait briefly for the engine mutex; no claim of
hard real-time maximum latency is made for OS/serial-driver operations.
New commands:
| Command | Purpose | Parameters / result |
|---|---|---|
| 12 | Client transaction timing | Normal handle; status[21] duration ms, [22] successful-read age ms (saturated UDINT); other client status fields retained |
| 40 | Configure/start global worker | startAddress=CPU+1 (0 inherited mask), connectTimeoutMs=interval 1..20, responseTimeoutMs=watchdog 100..60000 |
| 41 | Worker capabilities/status | No start side effect; available even before worker starts |
Worker status words: [0] capability 0x00040000; [1] running; [2] pthread error;
[3] configured CPU+1, 0 inherited mask; [4] interval ms; [5] watchdog ms;
[6:7] cycle counter low/high; [8:9] monotonic heartbeat low/high. Remaining words zero.
Error 260 reports worker initialization or CPU-affinity failure. Invalid settings
return 1. Invalid settings do not change current affinity/timing.
Client command 5 and server command 34 now refresh the context's scan lease and
snapshot state; they do not perform socket reads/writes. All deadline times are
sourced from CLOCK_MONOTONIC; the ABI nowMs argument is retained but ignored.
Command 6 rejects a new transaction until completion is acknowledged with command
10. Completion data cannot be overwritten by another request before acknowledgment.
Worker shutdown sets a stop flag, releases the mutex, joins the thread, then
closes contexts. Generation-tagged handles prevent access to released slots.
Watchdog expiry closes transport while preserving the slot and terminal result;
refresh resumes it. No worker thread is restarted repeatedly on link failure;
existing TCP/RTU state machines retry within it.
Socket progress is nonblocking. Socket close/configuration calls may also occur
synchronously for explicit close/reconfigure commands. These and serial ioctls are
OS calls, so target execution-time measurement remains necessary. The worker uses
normal SCHED_OTHER, not a high-priority busy loop.