How to make C program wait (on Linux)? (I need to use wait with MPI - I need C code please)
Or `nanosleep` in case he wants to wait less than a second: http://www.manpagez.com/man/2/nanosleep/ (it was clear from the link, but people skip right past links sometimes)
T.J. Crowder
2010-04-02 10:17:02
+5
A:
If you want to wait for a MPI request use MPI_Wait: http://www.manpagez.com/man/3/MPI_Wait/
If you want to wait a certain amount of time use sleep: http://www.manpagez.com/man/3/Sleep/
If you want to wait another process to end use waitpid: http://linux.die.net/man/2/waitpid
If you want to wait a condition variable (multi-threaded programming) use pthread_cond_wait: http://www.opengroup.org/onlinepubs/007908775/xsh/pthread_cond_wait.html
Define what you want to wait for.
Iulian Şerbănoiu
2010-04-02 11:08:37
And if you want MPI processes to wait on each other you might want to use mpi_barrier
High Performance Mark
2010-04-02 11:36:52