Dynad
Member
|
RE: Threading in a list
Ok i have a new question regarding threading...atm i make several threads but those threads are using the same object from a class which is e.g the world class. But now i dont know if EE locks down a thread and reopens it after a thread is done with it. Cause if multiple threads are gonna access a function at the same time can result in a disaster...
So my question is... does EE use locks in his threads?
There is always evil somewhere, you just have to look for it properly.
|
|
12-18-2010 02:26 AM |
|
Esenthel
Administrator
|
RE: Threading in a list
You need to use CritSect
|
|
12-18-2010 04:04 AM |
|
Dynad
Member
|
RE: Threading in a list
Ok but how does this exactly work? Is this instead of Thread? or do i need to call CritSect inside the thread which is needed to lock/unlock?
There is always evil somewhere, you just have to look for it properly.
|
|
12-18-2010 04:25 AM |
|
Dynad
Member
|
RE: Threading in a list
Ok i understand how it works... but when i call e.g:
CritSect crit;
crit.on();
//do something
crit.off();
When its in use and another thread calls the same function but of course its locked... does EE wait till its open again? or do i need to make a loop for it?
Do i need the same CritSect object in every thread/class where its needed? I don't think its possible but im not sure..
There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 12-18-2010 06:00 AM by Dynad.)
|
|
12-18-2010 05:50 AM |
|
Esenthel
Administrator
|
RE: Threading in a list
Yes you need the same cs object
|
|
12-18-2010 12:20 PM |
|
Dynad
Member
|
RE: Threading in a list
Ok but what about when i call crit.on() and the other thread does the same... is EE waiting till its open again or does it skip and leave it that way?
There is always evil somewhere, you just have to look for it properly.
|
|
12-18-2010 08:17 PM |
|
Esenthel
Administrator
|
RE: Threading in a list
it will wait
|
|
12-18-2010 08:18 PM |
|