Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

WIP: Batch mode #2

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

WIP: Batch mode #2

wants to merge 14 commits into from

Conversation

hjf
Copy link

@hjf hjf commented Dec 28, 2020

Trying to decouple UI logic from processing. Will add code for a command line version.

@hjf
Copy link
Author

hjf commented Dec 30, 2020

I'm not sure how to end the program because the writing process doesn't have a "break" in the while(1). So what I did was wait for EOF on the input, then add a 1 second delay to let the worker processes finish, and finally finish the program. Ugly hack but it seems to work.
I tried the 4 combinations of stdin to file, file to file, stdin to stdout and file to stdout with a random input file (a 500 meg noise only baseband recording) and then did a SHA hash of all 4 files. The 4 files matched.
I haven't tried compiling this in Windows but there is a windows-specific call to put Windows' stdin/out in binary mode.

@Aang23
Copy link
Member

Aang23 commented Dec 30, 2020

Indeed, a proper end sequence is something I had on my todo list. My idea was having bools for each loop, wait for each producer in the chain to stop, let the next worker finish up until the fifo is empty and then close off properly down to the last worker - that write data out.
Now a 1s timeout is definitely enough to let things finish up, and should work in the meantime even if that's still a pretty ugly hack... Shame on me for not doing this earlier I guess!

I just tried building in my mingw environment, everything built and worked as expected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants