Tommi Mäkitalo <tommi@...> writes:
> If you call tnt::Tntnet::shutdown, tntnet stops accepting new requests
> and waits until all requests are finished. There is no direct way to
> detect active requests.
>
> What about my suggestion to implement it in a global class? Any request,
> you want to monitor may instantiate a class, which increments a global
> (atomic) counter in the ctor and decrements it in the destructor. Then
> you can always check the counter.
Indeed, Denis could use an atomic with a RAII semantic to count open requests.
#include <atomic>
struct request_counter_t {
static std::atomic<int> OPEN_REQUESTS (0);
request_counter_t(){++OPEN_REQUESTS;}
~request_counter_t(){--OPEN_REQUESTS;}
};
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general