views:

137

answers:

1

Hello!

In objective c how would you get a function to pause until another one returns?

Thanks! Christian Stewart

A: 

Waiting until a called function to return is the ordinary behavior in most languages, including C, C++, Java, C# and I would guess also Objective-C.

In order to continue execution in the caller prior to return from the callee, you need to use some parallelization feature, such as threads, coroutines, or futures.

Ben Voigt
Indeed. The question is badly formulated, since this isn't actually what the yield keyword in javascript does.
calmh
Whoops... Anyway how to wait for return?
Christian Stewart
@Christian as Ben said, it always waits for the called function to return unless you go to some lengths to make it otherwise.
calmh