|
-
January 18th, 2013, 09:16 AM
#14
Re: Invalid access to memory location using GlobalFree
What's this critical section for?
Code:
EnterCriticalSection(&l_statcheck);
if (l_State == TRUE) {
exit(ShowError(ERR_HEARTBEAT));
}
LeaveCriticalSection(&l_statcheck);
No variable is being directly being assigned to. A comparison is done, and then a call to exit().
If ShowError for some reason needs to be synchronized, then that is where the critical section would be placed, and not at this level. Otherwise I see no need for the critical section -- this is paranoid programming by someone who didn't understand how and when to use synchronization objects.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; January 18th, 2013 at 09:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|