Witam.
Mam problem dotyczący przekazywania wielu argumentów do wątku z biblioteki process.h, spróbowałem przekazać jako tablicę niestety jako tablicę odczytać w wątku tego nie mogłem, więc postanowiłem być sprytny i drugi argument odczytać dodając 1 do wskaźnika, niestety przy próbie dostępu do drugiego argumentu program się crashuje.
Kod rozpoczęcia wątku:
void * ArgumentyDlaInterpretera[2];
void * Argument1 = reinterpret_cast < void* > ( &Pakiety );
void * Argument2 = reinterpret_cast < void* > ( &PakietyDoWyslania );
ArgumentyDlaInterpretera[0] = Argument1;
ArgumentyDlaInterpretera[1] = Argument2;
_beginthread(SG::InterpreterPakietow, 0, ArgumentyDlaInterpretera);
Kod ciała wątku:
void __cdecl InterpreterPakietow(void * args)
{
void * Arg1 = args;
void * Arg2 = args + 1;
queue < sf::Packet > * PakietyOdListenera = reinterpret_cast < queue<sf::Packet>* > (Arg1);
queue < sf::Packet > * PakietyDoWyslania = reinterpret_cast < queue<sf::Packet>* > (Arg2);
//Dalszy kod
}