On OSX, Lean was often crashing when using trace messages. I identified a problem in the thread finalization process. In OSX, the `silent_ios_helper` at `library/trace.cpp` was being finalized after the `null_streambuf` at `util/null_ostream.cpp`. There was also a memory corruption problem also related to `null_streambuf`. This commit fixes this problem by using the following recipe for creating null output stream buffers in C++. https://stackoverflow.com/questions/11826554/standard-no-op-output-stream
17 lines
371 B
C++
17 lines
371 B
C++
/*
|
|
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Leonardo de Moura
|
|
*/
|
|
#pragma once
|
|
#include <iostream>
|
|
|
|
#define LEAN_NULL_AUX_BUFFER_SIZE 64
|
|
|
|
namespace lean {
|
|
class null_streambuf : public std::streambuf {
|
|
protected:
|
|
virtual int overflow(int c) override { return c; }
|
|
};
|
|
}
|