Many thanks 3run.
proc_status was the key. With this I found another solution (in the manual) and it works for me:

Code:
function foo() 
{
  int i;
  for (i=0; i<100; i++) { wait(1); }
}
...
foo();
wait_for(foo); // wait until foo is terminated


Best regards!

Edit: Oh I wrote and dont saw the other answers, sorry xD
Thanks for all answers!

Last edited by Dragonfly; 11/02/15 12:55.

Errors are the engine of progress.

Version: A8 Commercial
OS: Win 7 64bit
Models: Cinema 4D