Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

Pause program to wait for external signal

ScottBoyce
Beginner
319 Views

For a fortran program are there any extensions (or even possible with Fortran standard) that can pause a program during execution and wait for a signal from an external source to resume execution.

 

My assumption is that the EXECUTE_COMMAND_LINE could work for running a separate program, but I would ideally like to have two separate programs that run in parallel and pause to communicate with each other when there is a needed information exchange. I could do binary files that one program waits for the other to update, but is there any way to send an electronic signal or even pass arrays within memory (RAM) or does that only work with subordinate programs compiled as dll?

0 Kudos
4 Replies
ScottBoyce
Beginner
319 Views

One main problem with the infinite loop that checks a file is that it would be using excessive CPU time while waiting. What would be even better if there was some way for the program to sleep/pause.

0 Kudos
Steven_L_Intel1
Employee
319 Views

The Windows API has many such synchronization features. Events are probably most relevant to your need.  The event would be created, one program would do WaitForSingleObject on the event and the other program would signal the event when ready. There are also mutexes. You might look at our DLL\DLL_Shared_Data sample for a use of mutexes used to synchronize two programs.

0 Kudos
ScottBoyce
Beginner
319 Views

OK great, where are those examples? Do the programs have to be DLLs or can they be stand alone executables?

0 Kudos
Steven_L_Intel1
Employee
319 Views

They are in the compiler folder under Samples\en_US\Fortran. Look in DLL.zip for this one. It has two programs that share data through a DLL. 

0 Kudos
Reply