mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
base: no exit handler for libc stdout log console
We don't want Genode environment objects that register their destructor for program exit as it is mostly unnecessary and easily produces dangling pointers. Thus, use unmanaged_singleton instead of the static keyword. Fixes #1941
This commit is contained in:
parent
bf5df7d88d
commit
cba6f5f298
@ -16,13 +16,10 @@
|
||||
#include <base/console.h>
|
||||
#include <base/lock.h>
|
||||
#include <base/env.h>
|
||||
#include <base/internal/unmanaged_singleton.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
void *operator new (size_t, void *ptr) { return ptr; }
|
||||
|
||||
|
||||
class Log_console : public Console
|
||||
{
|
||||
private:
|
||||
@ -104,18 +101,7 @@ class Log_console : public Console
|
||||
* use the 'Log_console' as backend.
|
||||
*/
|
||||
|
||||
Log_console *stdout_log_console()
|
||||
{
|
||||
/*
|
||||
* Construct the log console object on the first call of this function.
|
||||
* In constrast to having a static variable in the global scope, the
|
||||
* constructor gets only called when needed and no static constructor
|
||||
* gets invoked by the initialization code.
|
||||
*/
|
||||
static Log_console static_log_console;
|
||||
|
||||
return &static_log_console;
|
||||
}
|
||||
static Log_console *stdout_log_console() { return unmanaged_singleton<Log_console>(); }
|
||||
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user