# wait until a methd has finished?



## whitesaint (Apr 3, 2002)

Is there a way to wait until a certain method is finished, to perform another method?  All feedback is welcome and appreciated, thanks.

-whitesaint


----------



## ThinkingDiff (Apr 3, 2002)

How is the method being invoked??  I don't think there is no automatic multi-threading in objective C.


----------



## whitesaint (Apr 3, 2002)

im sorry i think you misunderstood me.

The method is being invoked just like any method-

[myObject performThisMethod:withArgument]; 

I did not mean automatic symmetric multithreading (lol), I meant is there a way for this method to finish it's data processing and stuff before the current object invokes another method....??

Thanks for the reply


----------



## Ghoser777 (Apr 3, 2002)

If I'm understanding you right, the answer is ALWAYS yes.  If that wasn't the way things worked, it would be incredibly hard to write code, as you would have to take into account the amount of a time for a method to run.

Look at this code:

```
int i = 0;
i = [self foo:i];
i = [self foo:i];
```

If foo didn't return before we move onto the second call to foo, we'd get an unexpected answer.  Running code is like reading a book - you read it in order, one word at a time.  You shouldn't skip ahead and miss words because that can change the meaning of statements.

Or am I missing what you're getting at?

F-bacher


----------

