moved dummy pool - started implementation of backend
This commit is contained in:
parent
da24b5a1a9
commit
2f0339334f
|
@ -30,6 +30,7 @@
|
|||
#include <limits>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
|
@ -211,6 +212,12 @@ public:
|
|||
|
||||
TheChunkAllocator chunkAllocator;
|
||||
|
||||
struct FBTraceLog {
|
||||
void open(const std::string& directory, const std::string& processName, unsigned rollsize, unsigned maxLogSize) {}
|
||||
};
|
||||
|
||||
thread_local FBTraceLog g_fbTraceLog;
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace ChunkAllocatorImpl {
|
||||
|
@ -249,4 +256,9 @@ void FBTraceImpl::operator delete(void* ptr) {
|
|||
|
||||
FBTraceImpl::~FBTraceImpl() {}
|
||||
|
||||
void FBTraceImpl::open(const std::string& directory, const std::string& processName, unsigned rollsize,
|
||||
unsigned maxLogSize) {
|
||||
g_fbTraceLog.open(directory, processName, rollsize, maxLogSize);
|
||||
}
|
||||
|
||||
void fbTraceImpl(Reference<FBTraceImpl> const& traceLine) {}
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
virtual FileIdentifier getFileIdentifier() const = 0;
|
||||
static void* operator new(std::size_t sz);
|
||||
static void operator delete(void* ptr);
|
||||
static void open(std::string const& directory, std::string const& processName, unsigned rollSize,
|
||||
unsigned maxLogSize);
|
||||
void addref() const;
|
||||
void delref() const;
|
||||
|
||||
|
@ -243,5 +245,5 @@ void fbTraceImpl(Reference<FBTraceImpl> const& traceLine);
|
|||
|
||||
template <class Type, class... Args>
|
||||
std::enable_if_t<std::is_base_of_v<FBTraceImpl, Type>> fbTrace(Args&&... args) {
|
||||
fbTraceImpl(Reference<FBTraceImpl>(new Type{std::forward<Args>(args)...}));
|
||||
fbTraceImpl(Reference<FBTraceImpl>(new Type{ std::forward<Args>(args)... }));
|
||||
}
|
||||
|
|
|
@ -105,5 +105,41 @@ private:
|
|||
|
||||
Reference<IThreadPool> createGenericThreadPool();
|
||||
|
||||
class DummyThreadPool : public IThreadPool, ReferenceCounted<DummyThreadPool> {
|
||||
public:
|
||||
~DummyThreadPool() {}
|
||||
DummyThreadPool() : thread(NULL) {}
|
||||
Future<Void> getError() {
|
||||
return errors.getFuture();
|
||||
}
|
||||
void addThread( IThreadPoolReceiver* userData ) {
|
||||
ASSERT( !thread );
|
||||
thread = userData;
|
||||
}
|
||||
void post( PThreadAction action ) {
|
||||
try {
|
||||
(*action)( thread );
|
||||
} catch (Error& e) {
|
||||
errors.sendError( e );
|
||||
} catch (...) {
|
||||
errors.sendError( unknown_error() );
|
||||
}
|
||||
}
|
||||
Future<Void> stop(Error const& e) {
|
||||
return Void();
|
||||
}
|
||||
void addref() {
|
||||
ReferenceCounted<DummyThreadPool>::addref();
|
||||
}
|
||||
void delref() {
|
||||
ReferenceCounted<DummyThreadPool>::delref();
|
||||
}
|
||||
|
||||
private:
|
||||
IThreadPoolReceiver* thread;
|
||||
Promise<Void> errors;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -55,41 +55,6 @@
|
|||
// during an open trace event
|
||||
thread_local int g_allocation_tracing_disabled = 1;
|
||||
|
||||
class DummyThreadPool : public IThreadPool, ReferenceCounted<DummyThreadPool> {
|
||||
public:
|
||||
~DummyThreadPool() {}
|
||||
DummyThreadPool() : thread(NULL) {}
|
||||
Future<Void> getError() {
|
||||
return errors.getFuture();
|
||||
}
|
||||
void addThread( IThreadPoolReceiver* userData ) {
|
||||
ASSERT( !thread );
|
||||
thread = userData;
|
||||
}
|
||||
void post( PThreadAction action ) {
|
||||
try {
|
||||
(*action)( thread );
|
||||
} catch (Error& e) {
|
||||
errors.sendError( e );
|
||||
} catch (...) {
|
||||
errors.sendError( unknown_error() );
|
||||
}
|
||||
}
|
||||
Future<Void> stop(Error const& e) {
|
||||
return Void();
|
||||
}
|
||||
void addref() {
|
||||
ReferenceCounted<DummyThreadPool>::addref();
|
||||
}
|
||||
void delref() {
|
||||
ReferenceCounted<DummyThreadPool>::delref();
|
||||
}
|
||||
|
||||
private:
|
||||
IThreadPoolReceiver* thread;
|
||||
Promise<Void> errors;
|
||||
};
|
||||
|
||||
struct SuppressionMap {
|
||||
struct SuppressionInfo {
|
||||
double endTime;
|
||||
|
|
Loading…
Reference in New Issue