Tutorial :How to make C program wait (on Linux)?



Question:

How to make C program wait (on Linux)? (I need to use wait with MPI - I need C code please)


Solution:1

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.


Solution:2

You can use sleep(seconds)


Solution:3

Wait for what exactly ? If you just want a delay use sleep().


Solution:4

Use MPI_Recv, and use MPI_Send to send a message to the waiting process when it should continue.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »