Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
I have an existing code base setup as follows. Text input, called Stream1 received from another system is continuously read in and is processed by a function CommandParser. CommandParser looks for commands in that input, and executes them and ignores anything that is not a command. Meanwhile, there are several other tasks running that periodically have to halt until they receive a certain response on Stream1. That response is not a command so currently it is ignored. Without a drastic rewrite, I’m looking for a way to notify the specific task that the specific string it was waiting for has come in. Only one task will be waiting for a string at a given time. I was thinking of creating a function notify(String toWaitFor) that tells CommandParser to set a boolean when it sees the desired string, then stop looking for it. The task would wait until it sees the boolean get set then resume or timeout. I feel like there must be a more elegant way to accomplish this. Your suggestions are appreciated.