mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 22:22:31 +00:00
Compatibility fixes with thread-safe list tracker changes.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#ifndef RTORRENT_UTILS_FUNCTIONAL_H
|
||||
#define RTORRENT_UTILS_FUNCTIONAL_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace utils {
|
||||
|
||||
// Create a class that calls a std::function when returning or exiting a scope.
|
||||
class scope_guard {
|
||||
public:
|
||||
scope_guard(std::function<void()> on_exit_scope) : m_on_exit_scope(on_exit_scope) {}
|
||||
~scope_guard() { m_on_exit_scope(); }
|
||||
|
||||
private:
|
||||
std::function<void()> m_on_exit_scope;
|
||||
};
|
||||
|
||||
} // namespace utils
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user