[Issue#] LINUXWRT-1061
[Problem] Remove FastDelegate
[Cause] Licensing issues
[Solution] Remove FastDelegate refernces from DPL::Once class.
[Verification]
1. Build repository with tests
2. Launch (on DUT):
- `wrt-commons-tests-core --output=text`
- `wrt-commons-tests-event --output=text`
The same number of tests should pass after and before applying this change.
Change-Id: I25ca5cbc229137b82d52137cd6296de3bae68c5e
#ifndef DPL_ONCE_H
#define DPL_ONCE_H
+#include <functional>
#include <dpl/noncopyable.h>
-#include <dpl/fast_delegate.h>
#include <dpl/atomic.h>
#include <dpl/mutex.h>
private Noncopyable
{
public:
- typedef FastDelegate<void ()> Delegate;
+ typedef std::function<void ()> Delegate;
void Call(Delegate delegate);
Type Get() const
{
Assert(this->m_readValue);
- m_once.Call(Once::Delegate(this, &ThisType::OnceEnsure));
+ m_once.Call(std::bind(&ThisType::OnceEnsure, this));
return this->m_value;
}
this->m_writeValue(value, m_model);
this->m_value = value;
- m_once.Call(Once::Delegate(this, &ThisType::OnceDisable));
+ m_once.Call(std::bind(&ThisType::OnceDisable, this));
}
};
* @version 1.0
* @brief This file is the implementation file of once tests
*/
+#include <functional>
+
#include <dpl/test/test_runner.h>
#include <dpl/once.h>
#include <dpl/waitable_event.h>
virtual int ThreadEntry()
{
DPL::WaitForSingleHandle(m_event->GetHandle());
- m_once->Call(DPL::Once::Delegate(this, &MyThread::Call));
+ m_once->Call(std::bind(&MyThread::Call, this));
return 0;
}