c++ - Creating parallel threads using Win 32 API -


here problem: have 2 sparse matrices described vector of triplets. task write multiplication function them using parallel processing win 32 api. need know how i:

1) create thread in win 32 api

2) pass input parameters it

3) return value.

thanks in advance!

edit: "process" changed "thread"

well, answer question createprocess , getexitcodeprocess.

but solution problem isn't process @ all, it's more threads. , openmp more suitable mechanism creating own threads.

if have use win32 api directly threads, process like:

  • build work item descriptor allocating memory, storing pointers real data, indexes thread going work on, etc. use structure keep organized.
  • call createthread , pass address of work item descriptor.
  • in thread procedure, cast pointer structure pointer, access work item descriptor, , process data.
  • in main thread, call waitformultipleobjects join worker threads.

for greater efficiency, can use windows thread pool , call queueuserworkitem. while won't have create threads yourself, you'd need event handles join tasks main thread. it's same amount of code suspect.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -