How to make a function wait until a callback has been called using node.js How to make a function wait until a callback has been called using node.js multithreading multithreading