About Store Forum Documentation Contact



Post Reply 
Threading in a list
Author Message
Dynad Offline
Member

Post: #16
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
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #17
RE: Threading in a list
You need to use CritSect
12-18-2010 04:04 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #18
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
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #19
RE: Threading in a list
12-18-2010 04:43 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #20
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
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #21
RE: Threading in a list
Yes you need the same cs object
12-18-2010 12:20 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #22
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
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #23
RE: Threading in a list
it will wait
12-18-2010 08:18 PM
Find all posts by this user Quote this message in a reply
Post Reply