unhandled read exception in thread after passing class into thread

69 Views Asked by At

http://pastebin.com/QPab6nkp is all my code, pretty messy and unfinished.

I found where is an error - i think im passing philosophist exemplar into thread incorectly, because into the thread, philosophist *ph = static_cast<philosophist*>(params); - that ph variable contains some garbage numbers insead of what i've passed (591519915,-519258915 and so on). Of course when i try to getID of philosophist, there is no such id in array of semaphors, gSems. How to pass that class into thread correctly?

1

There are 1 best solutions below

0
On BEST ANSWER

_beginthreadex(NULL, 0, &philosophistFunction, ph1, 0, 0);
there is no need for & before ph1