Synchronize functions using fibers