Wait for oscInFilter response?

I was wondering if there was a good approach to executing a function in a custom module, which will then send out a command through oscOutFilter, which awaits a response from oscInFilter before executing the next part of the function.

My initial thought is perhaps to create an outside variable to false and do a while (var === false), waiting until oscInFilter returns with a value, creating a function to listen for that which when received, set var to true to continue the oscOutFilter function.

I'm just thinking that if things fail I could get stuck in an infinite loop, and was wondering if there is a better approach with OSC?