Here is the problem: I have two sparse matrices described as vector of triplets. The task is to write multiplication function for them using parallel processing with Win 32 API. So I need to know how do I:
1) Create a thread in Win 32 API
2) Pass input parameters for it
3) Get return value.
Thanks in advance!
Edit: "Process" changed for "Thread"
Well, the answer to your question is CreateProcess
and GetExitCodeProcess
.
But the solution to your problem isn't another process at all, it's more threads. And probably OpenMP is a much more suitable mechanism than creating your own threads.
If you have to use the Win32 API directly for threads, the process is something like:
CreateThread
and pass the address of the work item descriptor. WaitForMultipleObjects
to join with the worker threads. For even greater efficiency, you can use the Windows thread pool and call QueueUserWorkItem
. But while you won't have to create threads yourself, you'd then need event handles to join tasks back to the main thread. It's about the same amount of code I suspect.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.