Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/frame synchronizer #968

Merged
merged 37 commits into from
Feb 18, 2025
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
690edf9
skeleton of structure for callbacks and funcitons updated
thattil Sep 10, 2024
5723d10
updated callback header structures and implemented in receiver
thattil Sep 11, 2024
65c3015
fixed bugs
thattil Sep 11, 2024
a954d7a
minor
thattil Sep 11, 2024
40234ac
formatting
thattil Sep 11, 2024
07cf58e
wip: draft of frame synchronizer, semaphores not done yet
thattil Sep 11, 2024
09f1bc7
signal handler not affecting semaphore inside lambda function
thattil Sep 11, 2024
6cb17d9
finally works with sem
thattil Sep 11, 2024
5f00db7
install targets cmake error fix
thattil Sep 11, 2024
68b1f1a
removed modified callback and instead passing by reference instead of…
thattil Sep 12, 2024
a81a56c
Merge branch 'dev/rx_callbacks' into dev/frame_synchronizer
thattil Sep 12, 2024
6715243
reducing the number of data call backs. incoming from developer
thattil Sep 12, 2024
a065882
added json header to receiver start acquiistion call back
thattil Sep 13, 2024
7704d3e
Merge branch 'dev/rx_callbacks' into dev/frame_synchronizer
thattil Sep 13, 2024
1debebd
Merge branch 'developer' into dev/rx_callbacks
thattil Sep 20, 2024
6884160
Merge branch 'developer' into dev/frame_synchronizer
thattil Sep 20, 2024
6166d2d
merge fix from developer and compile fix for startcallback adding jso…
thattil Sep 26, 2024
ab057c5
Merge branch 'dev/rx_callbacks' into dev/frame_synchronizer
thattil Sep 26, 2024
35d44c5
Merge branch 'developer' into dev/frame_synchronizer
thattil Feb 4, 2025
e14b228
WIP: of synchronisation (#969)
felix-engelmann Feb 4, 2025
717de59
allow frame synchronizer to have access to static libzmq when compili…
thattil Feb 4, 2025
39eed26
upto date with multirecieverapp for invalid arguments and help
thattil Feb 4, 2025
c2540e9
formatting
thattil Feb 4, 2025
2bef778
remove warnings
thattil Feb 4, 2025
89ab744
changes to print
thattil Feb 6, 2025
1fa0ef2
removed prints
thattil Feb 7, 2025
6b5f4b9
no need for print frames to be called
thattil Feb 7, 2025
ff13566
minor
thattil Feb 7, 2025
0198cc2
commnet
thattil Feb 7, 2025
61d6773
adding json header in start callback, imagesize in data callback and …
thattil Feb 10, 2025
d2cc14b
startcallback returns an unused int (changed to exceptions and forgot…
thattil Feb 10, 2025
0da3e4e
fixed sanitizer issues. 1 left for ctrl+C
thattil Feb 11, 2025
40895b0
fixed sanitizer issues and made it more readable
thattil Feb 12, 2025
53d17f4
moving clearing old frames to new startacq just in case it has to pro…
thattil Feb 13, 2025
ce74bd6
Merge branch 'developer' into dev/frame_synchronizer
thattil Feb 13, 2025
84a75bd
fix cherry-pick merge of fixing sanitizer thread issues but has start…
thattil Feb 13, 2025
90516dd
Merge branch 'developer' into dev/frame_synchronizer
thattil Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
finally works with sem
thattil committed Sep 11, 2024
commit 6cb17d908a27e239b3b6bb9261e5b4732e39681c
20 changes: 8 additions & 12 deletions slsReceiverSoftware/src/FrameSynchronizerApp.cpp
Original file line number Diff line number Diff line change
@@ -29,15 +29,15 @@
printf("\033[%dm" f RESET, 30 + c + 1, ##__VA_ARGS__)

std::vector<std::thread> threads;
std::vector<sem_t> semaphores;
std::vector<sem_t *> semaphores;

/**
* Control+C Interrupt Handler
* to let all the processes know to exit properly
*/
void sigInterruptHandler(int p) {
for (size_t i = 0; i != semaphores.size(); ++i) {
sem_post(&semaphores[i]);
sem_post(semaphores[i]);
}
}

@@ -236,11 +236,11 @@ int main(int argc, char *argv[]) {
/** - loop over number of receivers */
for (int i = 0; i != numReceivers; ++i) {

sem_t semaphore;
sem_init(&semaphore, 1, 0);
sem_t *semaphore = new sem_t;
sem_init(semaphore, 1, 0);
semaphores.push_back(semaphore);

threads.emplace_back([&semaphore, i, startTCPPort, withCallback,
threads.emplace_back([semaphore, i, startTCPPort, withCallback,
numReceivers]() {
sls::Receiver receiver(startTCPPort + i);

@@ -268,21 +268,17 @@ int main(int argc, char *argv[]) {
receiver.registerCallBackRawDataModifyReady(GetData,
nullptr);
}
usleep(3 * 1000 * 1000);

/** - Print Ready and Instructions how to exit */
if (i == (numReceivers - 1)) {
std::cout << "Ready ... " << std::endl;
cprintf(RESET, "[ Press \'Ctrl+c\' to exit ]\n");
}
cprintf(RED, "Receiver %d Started\n", i);
/** - as long as no Ctrl+C */
sem_wait(&semaphore);
cprintf(RED, "Receiver %d done waiting\n", i);
sem_destroy(&semaphore);
cprintf(RED, "Receiver %d Exiting\n", i);
sem_wait(semaphore);
sem_destroy(semaphore);
});
}
cprintf(RED, "Waiting for all threads to finish\n");

for (auto &thread : threads) {
thread.join();