Click here to Skip to main content
15,887,338 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Special character as button label Pin
Avi Berger26-Feb-10 12:13
Avi Berger26-Feb-10 12:13 
QuestionConditiona Modification of VERSIONINFO values Pin
softwaremonkey26-Feb-10 6:13
softwaremonkey26-Feb-10 6:13 
AnswerRe: Conditiona Modification of VERSIONINFO values Pin
Richard MacCutchan26-Feb-10 6:34
mveRichard MacCutchan26-Feb-10 6:34 
GeneralRe: Conditiona Modification of VERSIONINFO values Pin
softwaremonkey26-Feb-10 6:45
softwaremonkey26-Feb-10 6:45 
GeneralRe: Conditiona Modification of VERSIONINFO values Pin
Richard MacCutchan26-Feb-10 7:33
mveRichard MacCutchan26-Feb-10 7:33 
AnswerRe: Conditiona Modification of VERSIONINFO values Pin
cmk26-Feb-10 14:04
cmk26-Feb-10 14:04 
QuestionDeadlock occurs in Function Scoped Static variables (Thread Unsafe in VC++) Pin
Mohammed_Irfan26-Feb-10 2:52
Mohammed_Irfan26-Feb-10 2:52 
AnswerRe: Deadlock occurs in Function Scoped Static variables (Thread Unsafe in VC++) Pin
Avi Berger26-Feb-10 5:20
Avi Berger26-Feb-10 5:20 
In general a function that uses a local static variable is generally NOT reentrant. A function that is not reentrant is not thread-safe. It isn't merely deadlock, it can also produce bad results.

There is a different instance of an automatic variable for each invocation of a function, but all invocations share one and the same local static. Access to a shared resource from threads needs concurrency control.

In your case you are talking about a const variable. In this case, it shouldn't be a problem except during initialization. Further, the run time library seems to be putting in some concurrency control for what you are doing. This concurrency control is for a different issue and would probably not be adequate for your situation. It did get me to stop and take a broader look at your situation.

You are trying this in DLLMain. You really need to carefully read the documentaiion on DLLMain[^].

In particular:

Warning  There are serious limits on what you can do in a DLL entry point. 


and

Unfortunately, there is not a comprehensive list of safe functions in Kernel32.dll.


and

Calling functions that require DLLs other than Kernel32.dll may result in problems that are difficult to diagnose. 


and

DLL notifications are serialized


The bottom line seems to be that you are getting too fancy for DllMain. I'd suggest thinking about your design and trying to keep DllMain as bare bones and simple as possible.
Please do not read this signature.

GeneralRe: Deadlock occurs in Function Scoped Static variables (Thread Unsafe in VC++) Pin
Mohammed_Irfan28-Feb-10 22:06
Mohammed_Irfan28-Feb-10 22:06 
QuestionKilling a process by name Pin
transoft26-Feb-10 2:21
transoft26-Feb-10 2:21 
AnswerRe: Killing a process by name Pin
Eugen Podsypalnikov26-Feb-10 2:35
Eugen Podsypalnikov26-Feb-10 2:35 
AnswerRe: Killing a process by name Pin
Maximilien26-Feb-10 2:40
Maximilien26-Feb-10 2:40 
AnswerRe: Killing a process by name Pin
wangningyu26-Feb-10 20:22
wangningyu26-Feb-10 20:22 
AnswerRe: Killing a process by name Pin
Bram van Kampen26-Feb-10 21:41
Bram van Kampen26-Feb-10 21:41 
QuestionBUG IN C (LINKED LIST CODE).......please Help me Pin
sarojbobby26-Feb-10 1:59
sarojbobby26-Feb-10 1:59 
AnswerRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
Cedric Moonen26-Feb-10 2:05
Cedric Moonen26-Feb-10 2:05 
JokeRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
Nelek26-Feb-10 3:03
protectorNelek26-Feb-10 3:03 
JokeRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
Cedric Moonen26-Feb-10 3:13
Cedric Moonen26-Feb-10 3:13 
JokeRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
Nelek26-Feb-10 3:20
protectorNelek26-Feb-10 3:20 
GeneralRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
Cedric Moonen26-Feb-10 3:46
Cedric Moonen26-Feb-10 3:46 
JokeRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
Nelek26-Feb-10 3:56
protectorNelek26-Feb-10 3:56 
GeneralRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
CPallini26-Feb-10 6:02
mveCPallini26-Feb-10 6:02 
AnswerRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
CPallini26-Feb-10 2:08
mveCPallini26-Feb-10 2:08 
AnswerRe: BUG IN C (LINKED LIST CODE).......please Help me Pin
Avi Berger26-Feb-10 7:02
Avi Berger26-Feb-10 7:02 
QuestionDrag Drop from .net application to outside it Pin
Aseem Sharma26-Feb-10 1:56
Aseem Sharma26-Feb-10 1:56 

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.