Link to home
Start Free TrialLog in
Avatar of sdj_work
sdj_work

asked on

#pragma data_seg("shared") and threads?

In 16-bit land data in a dll could be shared. In 32-bit land the data can still be shared but must be declared in a #pragma data_seg compiler directive.

If I do this is there a new problem of the data being accessed across different thread boundaries? In which case do I have to place a critical section around access to all the shared data?
ASKER CERTIFIED SOLUTION
Avatar of piano_boxer
piano_boxer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sdj_work
sdj_work

ASKER

Is this point about the DLL process not getting the same shared area not covered by KB article: Q100634. In which case pointers would not actually work correctly but the data *is* still shared correctly?

Otherwise there would be no point in implementing the feature.
This is from Q100634:

"if the block cannot be loaded into the same memory address, it is mapped to a different address, but it is still shared.".

So I guess I'm wrong about data not beeing shared when dll's are relocated, but I would still use the memmory mapped file method.