How do I make a custom function that returns output and blocks until output is available? I'm thinking of something like Console.ReadLine()
. Something like this:
var resp = Output(); //blocks until output is sent.
...
//returns a string once SendOutput is called and hands over the string.
public static string Output() { /* what goes here? */ }
//Is this function even needed? Can I just fire Output somehow?
private static string SendOutput(string msg) { /* what goes here? */ }
...
//Calls sendoutput with the string to send.
SendOutput(msg);
Basically I'm making a listener that is blocked until it gets data (like it would if calling console.readline
), and I need the internal code to make the blocker.
SendOutput
to private. Hopefully that will clarify it. – Cyprinid