- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a Fortran program. It has two parts. The first part is about scientific calculating, and the second part is about TCP/IP communicating . When the program is started, the TCP/IP part will run on backgrounds and receive messages from other programs. While the scientific calculating part runs at the same time. So I need multi threads to make the two parts run at the same time. I know in C# we can build a new thread to start a function as follows. But what about Fortran? Thank you!
Thread th = new Thread(new ThreadStart(Listen));
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Take a look at the MSDN. There you will find the function CreateThread. The activities to be done by each thread (calculating and communicating) can be put in the ThrreadProc functions. Does this help?
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The modules ifmt and kernel32 both declare interfaces to CreateThread and CreateThreadX. Then use Robert's suggestion to consult MSDN for proper calling procedures.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the TCPIP part and the "scientific" part are completely independent, you can simply run them as two separate tasks.
If they are dependent, you have to know the synchronization requirements and implement the synchronization by making API calls or use a system based on directives such as OpenMP.
In general, there is more work involved in developing a multithreaded task than just launching a new thread.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page