Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Mar : SetConsoleCtrlHandler

www.cryer.info
Managed Newsgroup Archive

SetConsoleCtrlHandler

Subject:SetConsoleCtrlHandler
Posted by:"Alan" (al..@localhost.)
Date:17 Mar 2008 13:23:06

Is it safe to modify a variable in a ConsoleCtrlHandler function
without using a Critical Section? It is my understanding that Windows
creates a seperate thread to call your custom ConsoleCtrlHandler. So,
what happens if your application is currently accessing variable X and
the user presses Ctrl-C (calling your ConsoleCtrlHandler) which in
turn modifies variable X. Wouldn't that cause problems?

Replies:

www.cryer.info
Managed Newsgroup Archive