Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: third_party/lzma/v4_65/files/CPP/7zip/UI/Console/ConsoleClose.cpp

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // ConsoleClose.cpp
2
3 #include "StdAfx.h"
4
5 #include "ConsoleClose.h"
6
7 static int g_BreakCounter = 0;
8 static const int kBreakAbortThreshold = 2;
9
10 namespace NConsoleClose {
11
12 static BOOL WINAPI HandlerRoutine(DWORD ctrlType)
13 {
14 if (ctrlType == CTRL_LOGOFF_EVENT)
15 {
16 // printf("\nCTRL_LOGOFF_EVENT\n");
17 return TRUE;
18 }
19
20 g_BreakCounter++;
21 if (g_BreakCounter < kBreakAbortThreshold)
22 return TRUE;
23 return FALSE;
24 /*
25 switch(ctrlType)
26 {
27 case CTRL_C_EVENT:
28 case CTRL_BREAK_EVENT:
29 if (g_BreakCounter < kBreakAbortThreshold)
30 return TRUE;
31 }
32 return FALSE;
33 */
34 }
35
36 bool TestBreakSignal()
37 {
38 /*
39 if (g_BreakCounter > 0)
40 return true;
41 */
42 return (g_BreakCounter > 0);
43 }
44
45 void CheckCtrlBreak()
46 {
47 if (TestBreakSignal())
48 throw CCtrlBreakException();
49 }
50
51 CCtrlHandlerSetter::CCtrlHandlerSetter()
52 {
53 if(!SetConsoleCtrlHandler(HandlerRoutine, TRUE))
54 throw "SetConsoleCtrlHandler fails";
55 }
56
57 CCtrlHandlerSetter::~CCtrlHandlerSetter()
58 {
59 if(!SetConsoleCtrlHandler(HandlerRoutine, FALSE))
60 throw "SetConsoleCtrlHandler fails";
61 }
62
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698