VirtualBox

Changeset 21890 in vbox


Ignore:
Timestamp:
Jul 30, 2009 2:22:17 PM (15 years ago)
Author:
vboxsync
Message:

r3/init.cpp: Use an atexit callback to flush the default logs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/init.cpp

    r20911 r21890  
    124124
    125125
     126/**
     127 * atexit callback.
     128 *
     129 * This makes sure any loggers are flushed and will later also work the
     130 * termination callback chain.
     131 */
     132static void rtR3ExitCallback(void)
     133{
     134    if (g_cUsers > 0)
     135    {
     136        PRTLOGGER pLogger = RTLogGetDefaultInstance();
     137        if (pLogger)
     138            RTLogFlush(pLogger);
     139
     140        pLogger = RTLogRelDefaultInstance();
     141        if (pLogger)
     142            RTLogFlush(pLogger);
     143    }
     144}
     145
    126146
    127147#ifndef RT_OS_WINDOWS
     
    269289    setlocale(LC_CTYPE, "");
    270290
    271     /* Fork callbacks. */
     291    /* Fork and exit callbacks. */
    272292#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
    273293    rc = pthread_atfork(NULL, NULL, rtR3ForkChildCallback);
    274294    AssertMsg(rc == 0, ("%d\n", rc));
    275295#endif
     296    atexit(rtR3ExitCallback);
    276297
    277298#ifdef IPRT_WITH_ALIGNMENT_CHECKS
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