diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h')
-rw-r--r-- | contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h b/contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h index 571871be98..4dac98a98c 100644 --- a/contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h +++ b/contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h @@ -1,78 +1,78 @@ -// -// RunnableAdapter.h -// -// Library: Foundation -// Package: Threading -// Module: Thread -// -// Definition of the RunnableAdapter template class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_RunnableAdapter_INCLUDED -#define Foundation_RunnableAdapter_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/Runnable.h" - - -namespace Poco { - - -template <class C> -class RunnableAdapter: public Runnable - /// This adapter simplifies using ordinary methods as - /// targets for threads. - /// Usage: - /// RunnableAdapter<MyClass> ra(myObject, &MyObject::doSomething)); - /// Thread thr; - /// thr.Start(ra); - /// - /// For using a freestanding or static member function as a thread - /// target, please see the ThreadTarget class. -{ -public: - typedef void (C::*Callback)(); - - RunnableAdapter(C& object, Callback method): _pObject(&object), _method(method) - { - } - - RunnableAdapter(const RunnableAdapter& ra): _pObject(ra._pObject), _method(ra._method) - { - } - - ~RunnableAdapter() - { - } - - RunnableAdapter& operator = (const RunnableAdapter& ra) - { - _pObject = ra._pObject; - _method = ra._method; - return *this; - } - - void run() - { - (_pObject->*_method)(); - } - -private: - RunnableAdapter(); - - C* _pObject; - Callback _method; -}; - - -} // namespace Poco - - -#endif // Foundation_RunnableAdapter_INCLUDED +// +// RunnableAdapter.h +// +// Library: Foundation +// Package: Threading +// Module: Thread +// +// Definition of the RunnableAdapter template class. +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef Foundation_RunnableAdapter_INCLUDED +#define Foundation_RunnableAdapter_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/Runnable.h" + + +namespace Poco { + + +template <class C> +class RunnableAdapter: public Runnable + /// This adapter simplifies using ordinary methods as + /// targets for threads. + /// Usage: + /// RunnableAdapter<MyClass> ra(myObject, &MyObject::doSomething)); + /// Thread thr; + /// thr.Start(ra); + /// + /// For using a freestanding or static member function as a thread + /// target, please see the ThreadTarget class. +{ +public: + typedef void (C::*Callback)(); + + RunnableAdapter(C& object, Callback method): _pObject(&object), _method(method) + { + } + + RunnableAdapter(const RunnableAdapter& ra): _pObject(ra._pObject), _method(ra._method) + { + } + + ~RunnableAdapter() + { + } + + RunnableAdapter& operator = (const RunnableAdapter& ra) + { + _pObject = ra._pObject; + _method = ra._method; + return *this; + } + + void run() + { + (_pObject->*_method)(); + } + +private: + RunnableAdapter(); + + C* _pObject; + Callback _method; +}; + + +} // namespace Poco + + +#endif // Foundation_RunnableAdapter_INCLUDED |