From: Uwe Hermann Date: Tue, 8 Jan 2019 22:27:41 +0000 (+0100) Subject: Srf::deinit(): Add initial implementation. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=870da4f2db97d266ad53cfa3ad9ad42e7d305379;p=libsigrokflow.git Srf::deinit(): Add initial implementation. --- diff --git a/include/libsigrokflow/libsigrokflow.hpp b/include/libsigrokflow/libsigrokflow.hpp index c13e1c6..944c99c 100644 --- a/include/libsigrokflow/libsigrokflow.hpp +++ b/include/libsigrokflow/libsigrokflow.hpp @@ -42,6 +42,8 @@ using namespace std; void init(); +void deinit(); + class Block { /* Config API etc goes here */ diff --git a/src/main.cpp b/src/main.cpp index 45d2308..8f95317 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,11 +28,11 @@ namespace Srf using namespace std; using namespace std::placeholders; +static bool srf_initialized_ = false; + void init() { - static bool srf_initialized = false; - - if (srf_initialized) + if (srf_initialized_) throw runtime_error("libsigrokflow is already initialized"); #ifdef HAVE_LIBSIGROKCXX @@ -60,7 +60,12 @@ void init() "0.01", "GPL", "sigrok", "libsigrokflow", "http://sigrok.org"); #endif - srf_initialized = true; + srf_initialized_ = true; +} + +void deinit() +{ + srf_initialized_ = false; } Sink::Sink(GstBaseSink *gobj) :