[pso] Probleme Threaduri in C++
Alexandru Bleotu
alexbleotu at gmail.com
Sun May 17 11:32:52 EEST 2009
Threadul principal nu moare... mai mult doua dintre threaduri continua...
banuim ca este vorba despre memory corruption
2009/5/17 Mircea Bardac <cs at mircea.bardac.net>
> Salut,
>
> ovidiu popa wrote:
> > Am o aplicatie in C++ care porneste 5 threaduri.
> > In momentul in care functia asociata unui thread ajunge la sfarsitul
> > executiei se incheie executia si a altui thread care ar trebui sa ruleze
> o
> > bucla infinita...
>
> Nu sunt convins ca am inteles bine problema asa ca o sa reformulez un
> pic: cand se termina thread-ul 1, observi ca s-a terminat si thread-ul 2
> cu toate ca thread-ul 2 ar trebui inca sa mai ruleze.
>
> O idee: verifica faptul ca in thread-ul principal (acolo unde creezi
> cele 2 thread-uri) astepti ambele thread-uri, nu doar thread-ul 1
> (WaitForSingleObject/WaitForMultipleObjects). Daca astepti doar
> thread-ul 1, thread-ul principal isi va continua executia => aplicatia
> se va termina (ExitProcess) => toate thread-urile aplicatiei vor fi
> terminate.
>
> Good luck.
>
> --
> Mircea
> http://mircea.bardac.net
> _______________________________________________
> pso mailing list
> pso at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/pso
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/pso/attachments/20090517/5d668fd3/attachment.htm>
More information about the pso
mailing list