Click here to Skip to main content
15,927,921 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C++ question Pin
Chris Meech17-Nov-05 10:29
Chris Meech17-Nov-05 10:29 
AnswerRe: C++ question Pin
Owner drawn17-Nov-05 17:39
Owner drawn17-Nov-05 17:39 
GeneralRe: C++ question Pin
David Crow18-Nov-05 5:19
David Crow18-Nov-05 5:19 
GeneralRe: C++ question Pin
cmk18-Nov-05 13:09
cmk18-Nov-05 13:09 
GeneralRe: C++ question Pin
David Crow19-Nov-05 7:06
David Crow19-Nov-05 7:06 
GeneralRe: C++ question Pin
Owner drawn20-Nov-05 17:52
Owner drawn20-Nov-05 17:52 
GeneralRe: C++ question Pin
David Crow21-Nov-05 3:10
David Crow21-Nov-05 3:10 
AnswerRe: C++ question Pin
cmk18-Nov-05 2:19
cmk18-Nov-05 2:19 
QuestionDLL Function Noobie Pin
tadieckmann17-Nov-05 8:03
tadieckmann17-Nov-05 8:03 
AnswerRe: DLL Function Noobie Pin
kakan17-Nov-05 20:31
professionalkakan17-Nov-05 20:31 
Questionoddities of visual studio.net 2005.... Pin
(Steven Hicks)n+117-Nov-05 6:52
(Steven Hicks)n+117-Nov-05 6:52 
QuestionThreads in MFC - trying to understand... Pin
charlieg17-Nov-05 6:44
charlieg17-Nov-05 6:44 
AnswerRe: Threads in MFC - trying to understand... Pin
David Crow17-Nov-05 8:56
David Crow17-Nov-05 8:56 
GeneralRe: Threads in MFC - trying to understand... Pin
charlieg17-Nov-05 9:00
charlieg17-Nov-05 9:00 
AnswerRe: Threads in MFC - trying to understand... Pin
Sheng Jiang 蒋晟17-Nov-05 12:44
Sheng Jiang 蒋晟17-Nov-05 12:44 
GeneralRe: Threads in MFC - trying to understand... Pin
charlieg17-Nov-05 13:55
charlieg17-Nov-05 13:55 
GeneralRe: Threads in MFC - trying to understand... Pin
Sheng Jiang 蒋晟17-Nov-05 14:17
Sheng Jiang 蒋晟17-Nov-05 14:17 
QuestionThread Safe Static Library Problem Pin
Federico Milano17-Nov-05 2:38
Federico Milano17-Nov-05 2:38 
Hi,

I'm programming a library. It must be thread-safe, so I've a global critical section variable to synchronize the calls among the different calling threads. I also want to offer the possibility to link it against the client as a static library or as a dynamic library. The problem is that InitializeCriticalSection doesn't support multi-threading, in the sense that if it's called from more than one thread with the same CRITICAL_SECTION object, it's result it's undefined. There's no problem in the case that the client is linking with the dynamic library, because I know that DllMain is called just by one thread.
The problem is that, in case it's linked as a static library, I'm forced to 1) write an init() function that should be called by the client (only once) to initialize the critical section: the problem is that the client could forget to call it...or could call it from more than one thread simultaniously (and I can't protect init() since I don't have any critical sections yet) 2) create a static object that in its constructor it initializes the critical section: according to the c++ standard we don't know what will be the static object initialization order amongst different modules...so I can receive a call from the client before initializing the critical section...

If anybody has any suggestion, please let me know

Thanks,

Federico


AnswerRe: Thread Safe Static Library Problem Pin
Graham Bradshaw17-Nov-05 2:48
Graham Bradshaw17-Nov-05 2:48 
GeneralRe: Thread Safe Static Library Problem Pin
Federico Milano17-Nov-05 4:17
Federico Milano17-Nov-05 4:17 
AnswerRe: Thread Safe Static Library Problem Pin
Tim Smith17-Nov-05 3:01
Tim Smith17-Nov-05 3:01 
AnswerRe: Thread Safe Static Library Problem Pin
James R. Twine17-Nov-05 6:09
James R. Twine17-Nov-05 6:09 
QuestionCHtmlView problem ? Pin
kendao17-Nov-05 2:34
kendao17-Nov-05 2:34 
AnswerRe: CHtmlView problem ? Pin
Sheng Jiang 蒋晟17-Nov-05 12:47
Sheng Jiang 蒋晟17-Nov-05 12:47 
QuestionCImageList question? Pin
followait17-Nov-05 0:39
followait17-Nov-05 0:39 

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.