Dev/frame synchronizer (#968)

* skeleton of structure for callbacks and funcitons updated

* updated callback header structures and implemented in receiver

* fixed bugs

* minor

* formatting

* wip: draft of frame synchronizer, semaphores not done yet

* signal handler not affecting semaphore inside lambda function

* finally works with sem

* install targets cmake error fix

* removed modified callback and instead passing by reference instead of value to the oriignal receiver data callback

* reducing the number of data call backs. incoming from developer

* added json header to receiver start acquiistion call back

* WIP: of synchronisation (#969)

* WIP of synchronisation

* working so far if everything goes right

* added all information into json headers

* valid json

* allow frame synchronizer to have access to static libzmq when compiling on conda (libzeromq-devel not installed by default

* upto date with multirecieverapp for invalid arguments and help

* formatting

* remove warnings

* changes to print

* removed prints

* no need for print frames to be called

* minor

* commnet

* adding json header in start callback, imagesize in data callback and formatted

* startcallback returns an unused int (changed to exceptions and forgotten in last modification to callbacks likely)

* fixed sanitizer issues. 1 left for ctrl+C
- zmq_msg_t should be deleted, not freed. Same with the char arrays and semaphores.

* fixed sanitizer issues and made it more readable

* moving clearing old frames to new startacq just in case it has to process soem frames before the callback

* fix cherry-pick merge of fixing sanitizer thread issues but has start callbacks signature change.fixed

---------

Co-authored-by: Felix Engelmann <felix-github@nlogn.org>
This commit is contained in:
2025-02-18 11:28:21 +01:00
committed by GitHub
parent f1f369b48c
commit e933a25453
12 changed files with 714 additions and 35 deletions

View File

@@ -34,9 +34,8 @@ class ClientInterface : private virtual slsDetectorDefs {
//***callback functions***
/** params: file path, file name, file index, image size */
void registerCallBackStartAcquisition(int (*func)(const startCallbackHeader,
void *),
void *arg);
void registerCallBackStartAcquisition(
void (*func)(const startCallbackHeader, void *), void *arg);
/** params: total frames caught */
void registerCallBackAcquisitionFinished(
@@ -180,8 +179,8 @@ class ClientInterface : private virtual slsDetectorDefs {
//***callback parameters***
int (*startAcquisitionCallBack)(const startCallbackHeader,
void *) = nullptr;
void (*startAcquisitionCallBack)(const startCallbackHeader,
void *) = nullptr;
void *pStartAcquisition{nullptr};
void (*acquisitionFinishedCallBack)(const endCallbackHeader,
void *) = nullptr;
@@ -194,6 +193,8 @@ class ClientInterface : private virtual slsDetectorDefs {
pid_t tcpThreadId{0};
std::vector<std::string> udpips =
std::vector<std::string>(MAX_NUMBER_OF_LISTENING_THREADS);
// necessary if Receiver objects using threads with callbacks
static std::mutex callbackMutex;
};
} // namespace sls