VirtualBox

Ignore:
Timestamp:
Aug 24, 2022 11:48:12 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
153320
Message:

ValKit/vkat,Devices/Audio: Made vkat build in no-CRT mode. bugref:10261

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp

    r96407 r96472  
    6363
    6464#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>
    6668#endif
    67 #include <signal.h>
    6869
    6970#include "vkatInternal.h"
     
    12721273 * Ctrl-C signal handler.
    12731274 *
    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
     1282static 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
    12781293static void audioTestSignalHandler(int iSig) RT_NOEXCEPT
    12791294{
    12801295    Assert(iSig == SIGINT); RT_NOREF(iSig);
    12811296    RTPrintf("Ctrl-C!\n");
     1297
    12821298    ASMAtomicWriteBool(&g_fTerminate, true);
     1299
    12831300    signal(SIGINT, SIG_DFL);
    12841301}
     1302#endif
    12851303
    12861304/**
    12871305 * Commands.
    12881306 */
    1289 const VKATCMD *g_apCommands[] =
     1307static const VKATCMD * const g_apCommands[] =
    12901308{
    12911309    &g_CmdTest,
     
    13821400    int rc = RTR3InitExe(argc, &argv, 0);
    13831401    if (RT_FAILURE(rc))
    1384     {
    1385         RTPrintf("RTR3InitExe() failed with %Rrc\n", rc);
    13861402        return RTMsgInitFailure(rc);
    1387     }
    13881403
    13891404    /*
     
    15091524     */
    15101525#ifdef RT_OS_WINDOWS
    1511     signal(SIGINT, audioTestSignalHandler);
     1526    SetConsoleCtrlHandler(audioTestConsoleCtrlHandler, TRUE);
    15121527#else
    15131528    struct sigaction sa;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette