Changeset 96472 in vbox for trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
- Timestamp:
- Aug 24, 2022 11:48:12 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 153320
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r96407 r96472 63 63 64 64 #ifdef RT_OS_WINDOWS 65 # include <iprt/win/windows.h> /* for CoInitializeEx */ 65 # include <iprt/win/windows.h> /* for CoInitializeEx and SetConsoleCtrlHandler */ 66 #else 67 # include <signal.h> 66 68 #endif 67 #include <signal.h>68 69 69 70 #include "vkatInternal.h" … … 1272 1273 * Ctrl-C signal handler. 1273 1274 * 1274 * This just sets g_fTerminate and hope it will be noticed soon. It restores 1275 * the SIGINT action to default, so that a second Ctrl-C will have the normal 1276 * effect (just in case the code doesn't respond to g_fTerminate). 1277 */ 1275 * This just sets g_fTerminate and hope it will be noticed soon. 1276 * 1277 * On non-Windows it restores the SIGINT action to default, so that a second 1278 * Ctrl-C will have the normal effect (just in case the code doesn't respond to 1279 * g_fTerminate). 1280 */ 1281 #ifdef RT_OS_WINDOWS 1282 static BOOL CALLBACK audioTestConsoleCtrlHandler(DWORD dwCtrlType) 1283 { 1284 if (dwCtrlType != CTRL_C_EVENT && dwCtrlType != CTRL_BREAK_EVENT) 1285 return false; 1286 RTPrintf(dwCtrlType == CTRL_C_EVENT ? "Ctrl-C!\n" : "Ctrl-Break!\n"); 1287 1288 ASMAtomicWriteBool(&g_fTerminate, true); 1289 1290 return true; 1291 } 1292 #else 1278 1293 static void audioTestSignalHandler(int iSig) RT_NOEXCEPT 1279 1294 { 1280 1295 Assert(iSig == SIGINT); RT_NOREF(iSig); 1281 1296 RTPrintf("Ctrl-C!\n"); 1297 1282 1298 ASMAtomicWriteBool(&g_fTerminate, true); 1299 1283 1300 signal(SIGINT, SIG_DFL); 1284 1301 } 1302 #endif 1285 1303 1286 1304 /** 1287 1305 * Commands. 1288 1306 */ 1289 const VKATCMD *g_apCommands[] =1307 static const VKATCMD * const g_apCommands[] = 1290 1308 { 1291 1309 &g_CmdTest, … … 1382 1400 int rc = RTR3InitExe(argc, &argv, 0); 1383 1401 if (RT_FAILURE(rc)) 1384 {1385 RTPrintf("RTR3InitExe() failed with %Rrc\n", rc);1386 1402 return RTMsgInitFailure(rc); 1387 }1388 1403 1389 1404 /* … … 1509 1524 */ 1510 1525 #ifdef RT_OS_WINDOWS 1511 signal(SIGINT, audioTestSignalHandler);1526 SetConsoleCtrlHandler(audioTestConsoleCtrlHandler, TRUE); 1512 1527 #else 1513 1528 struct sigaction sa;
Note:
See TracChangeset
for help on using the changeset viewer.