Click here to Skip to main content
16,010,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Stack problems Pin
Tim Smith22-Mar-02 17:07
Tim Smith22-Mar-02 17:07 
GeneralRe: Stack problems Pin
Nish Nishant22-Mar-02 20:30
sitebuilderNish Nishant22-Mar-02 20:30 
GeneralRe: Stack problems Pin
Tim Smith23-Mar-02 4:13
Tim Smith23-Mar-02 4:13 
GeneralC2440 Pin
22-Mar-02 14:17
suss22-Mar-02 14:17 
GeneralRe: C2440 Pin
Nish Nishant22-Mar-02 14:23
sitebuilderNish Nishant22-Mar-02 14:23 
GeneralRe: C2440 Pin
22-Mar-02 14:34
suss22-Mar-02 14:34 
GeneralRe: C2440 Pin
Nish Nishant22-Mar-02 14:43
sitebuilderNish Nishant22-Mar-02 14:43 
Generalseveral Threads.....trying to access same array item Pin
22-Mar-02 14:01
suss22-Mar-02 14:01 
Hi,
I have a question about multithread.

Let say there is an array called DBObject[100], and my thread function need access to this array. All threads are required to get a "permit" from the main function, so that this thread can have permission to access the particular data item in array.

Permission will be granted IF DBObject[i]= "free"

Let say:
Thread A: 1. Ask for permission to change DBObject[10] -> "X"
2. If permission receive ---- (DBObject[10]= "free"),
then change DBObject[10] -> "X"
3. Else, wait until DBObject[10]="free"

Thread B: 1. Ask for permission to change DBOject[10] -> "Y"
2. If permission receive ---- (DBObject[10]= "free"),
then change DBObject[10] -> "Y"
3. Else, wait until DBObject[10]="free"

(basically, they are using the same thread function.....)


My question is: Is it possible that both thread A and B can read the DBObject[10]="free" at the same time and therefore, think that they have permission to access DBObject[10] and change the DBOject[10] value at the same time. (if it's happened, then i don't know what will happen......)

p.s.: (the point (1), (2) and (3) are stored in a normal function (not thread), and those thread function just calls this function with some parameters);P

Please help!!!!!!!!!
GeneralRe: several Threads.....trying to access same array item Pin
Nish Nishant22-Mar-02 14:13
sitebuilderNish Nishant22-Mar-02 14:13 
GeneralRe: several Threads.....trying to access same array item Pin
soptest22-Mar-02 14:11
soptest22-Mar-02 14:11 
GeneralRe: several Threads.....trying to access same array item Pin
Nish Nishant22-Mar-02 14:15
sitebuilderNish Nishant22-Mar-02 14:15 
GeneralDid I say something different? Pin
soptest22-Mar-02 14:53
soptest22-Mar-02 14:53 
GeneralRe: Did I say something different? Pin
Nish Nishant22-Mar-02 16:02
sitebuilderNish Nishant22-Mar-02 16:02 
GeneralRe: several Threads.....trying to access same array item Pin
22-Mar-02 14:18
suss22-Mar-02 14:18 
GeneralRe: several Threads.....trying to access same array item Pin
Nish Nishant22-Mar-02 14:18
sitebuilderNish Nishant22-Mar-02 14:18 
GeneralRe: several Threads.....trying to access same array item Pin
22-Mar-02 14:37
suss22-Mar-02 14:37 
GeneralRe: several Threads.....trying to access same array item Pin
Nish Nishant22-Mar-02 14:39
sitebuilderNish Nishant22-Mar-02 14:39 
GeneralRe: several Threads.....trying to access same array item Pin
22-Mar-02 14:49
suss22-Mar-02 14:49 
GeneralLinking to a Win32 DLL Pin
Don Burton22-Mar-02 13:57
Don Burton22-Mar-02 13:57 
GeneralRe: Linking to a Win32 DLL Pin
Nish Nishant22-Mar-02 14:12
sitebuilderNish Nishant22-Mar-02 14:12 
GeneralRe: Linking to a Win32 DLL Pin
Don Burton22-Mar-02 14:47
Don Burton22-Mar-02 14:47 
GeneralRe: Linking to a Win32 DLL Pin
Nish Nishant22-Mar-02 14:44
sitebuilderNish Nishant22-Mar-02 14:44 
GeneralRe: Linking to a Win32 DLL Pin
Don Burton22-Mar-02 15:50
Don Burton22-Mar-02 15:50 
GeneralLock a ComboBox Pin
22-Mar-02 13:48
suss22-Mar-02 13:48 
GeneralRe: Lock a ComboBox Pin
Nish Nishant22-Mar-02 13:58
sitebuilderNish Nishant22-Mar-02 13:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.