Skip to content

Commit b932d55

Browse files
committed
Use parking_lot mutex for CalSeg::sync, use OS mutex for MPSC queue
1 parent 8c8b2ae commit b932d55

24 files changed

+270
-172
lines changed

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ lazy_static = "1.4.0"
124124
once_cell = "1.19.0"
125125
static_cell = "2.1.0"
126126

127+
# More compact and efficient implementations of the standard synchronization primitives
128+
# Used for the mutex in CalSeg::sync()
129+
parking_lot = "0.12.3"
130+
127131
# proc-macro A2L serializer for structs
128132
xcp_type_description = { path = "./xcp_type_description/", optional = true}
129133
xcp_type_description_derive = { path = "./xcp_type_description/xcp_type_description_derive/", optional = true }

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ All measurement and calibration code instrumentation is non blocking and the tri
268268
There are no heap allocation during runtime, except for the lazy registrations of and for A2L generation.
269269
270270
build.rs automatically builds a minimum static C library from individially preconfigured core XCPlite sources.
271-
On C level, there is a synchronisation mutex or spinlock for the mpsc transmit queue.
271+
On C level, there is a synchronisation mutex for the mpsc transmit queue.
272272
The C code has the option to start the server with 2 normal threads for rx and tx socket handling.
273273
274274
The generated A2L file is finalized on XCP connect and provided for upload via XCP.
@@ -288,15 +288,16 @@ These concepts are currently not supported by the A2L update tools, though A2L g
288288
The EPK version string in the A2L file can be set by the application. It resides a seperate, hardcoded const memory segment.
289289
290290
291-
## Future improvements
291+
## Possible improvements
292292
293293
- Create a minimal lock MPSC event queue, increase queue efficiency (optimize mutex contention) for many daq lists and events
294294
- Support more types of calibration parameters, including types for curves and maps with axis
295295
- Avoid the mutex lock in CalSeg::Sync when there is no pending parameter modification
296296
- Improve the meta data annotations of the A2L serializer
297297
- Reduce the number of heap allocations and strings, reduce the overall memory footprint
298298
- Add sub groups of measurements for event instances
299-
- Add support to decribe the application clock domain in rust
299+
- Improve the pointer provenance checks in XcpEvent
300+
- Add support to describe the application clock domain in rust
300301
- Provide a no-std version and create a embassy example
301302
302303

examples/multi_thread_demo/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn main() {
126126

127127
// Test
128128
thread::sleep(Duration::from_millis(1000));
129-
xcp.write_a2l().unwrap();
129+
xcp.write_a2l().unwrap(); // @@@@ Remove: force A2L write
130130

131131
t.into_iter().for_each(|t| t.join().unwrap());
132132

examples/point_cloud_demo/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,6 @@ fn main() {
162162
event_point_cloud.trigger();
163163

164164
params.sync();
165-
xcp.write_a2l().unwrap();
165+
xcp.write_a2l().unwrap(); // @@@@ Remove: force A2L write
166166
}
167167
}

examples/protobuf_demo/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,6 @@ fn main() {
218218

219219
thread::sleep(Duration::from_micros(1000000));
220220

221-
xcp.write_a2l().unwrap(); // @@@@ test
221+
xcp.write_a2l().unwrap(); // @@@@ Remove: force A2L write
222222
}
223223
}

examples/single_thread_demo/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ fn main() {
111111

112112
thread::sleep(Duration::from_millis(10)); // 100 Hz
113113

114-
xcp.write_a2l().unwrap();
114+
xcp.write_a2l().unwrap(); // @@@@ Remove: force A2L write
115115
}
116116

117117
// Stop the XCP server

0 commit comments

Comments
 (0)