[native] Rename NullTimeoutFactory to InfiniteTimeoutFactory (#35)

This commit is contained in:
Ara Ayvazyan 2020-02-11 19:49:20 -08:00 коммит произвёл GitHub
Родитель bc155cee28
Коммит 08abfade38
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 34 добавлений и 34 удалений

Просмотреть файл

@ -1,25 +1,25 @@
#pragma once
#include "IPC/detail/Callback.h"
#include <chrono>
namespace IPC
{
namespace Policies
{
/// Provides infinite timeout behavior. The provided handler is not preserved.
class NullTimeoutFactory
{
public:
NullTimeoutFactory(const std::chrono::milliseconds& /*defaultTimeout*/ = {})
{}
auto operator()(const detail::Callback<void()>& /*handler*/) const
{
return [](auto&&...) {};
}
};
} // Policies
} // IPC
#pragma once
#include "IPC/detail/Callback.h"
#include <chrono>
namespace IPC
{
namespace Policies
{
/// Provides infinite timeout behavior. The provided handler is not preserved.
class InfiniteTimeoutFactory
{
public:
InfiniteTimeoutFactory(const std::chrono::milliseconds& /*defaultTimeout*/ = {})
{}
auto operator()(const detail::Callback<void()>& /*handler*/) const
{
return [](auto&&...) {};
}
};
} // Policies
} // IPC

Просмотреть файл

@ -1,7 +1,7 @@
#pragma once
#include "TransactionManagerFwd.h"
#include "NullTimeoutFactory.h"
#include "InfiniteTimeoutFactory.h"
#include "IPC/detail/LockFree/IndexedObjectPool.h"
#include <chrono>
#include <cassert>

Просмотреть файл

@ -5,9 +5,9 @@ namespace IPC
{
namespace Policies
{
class NullTimeoutFactory;
class InfiniteTimeoutFactory;
template <typename Context, typename TimeoutFactory = NullTimeoutFactory>
template <typename Context, typename TimeoutFactory = InfiniteTimeoutFactory>
class TransactionManager;
} // Policies

Просмотреть файл

@ -80,7 +80,7 @@
<ClInclude Include="..\..\Inc\IPC\Policies\AsyncReceiverFactory.h" />
<ClInclude Include="..\..\Inc\IPC\Policies\ErrorHandler.h" />
<ClInclude Include="..\..\Inc\IPC\Policies\InlineReceiverFactory.h" />
<ClInclude Include="..\..\Inc\IPC\Policies\NullTimeoutFactory.h" />
<ClInclude Include="..\..\Inc\IPC\Policies\InfiniteTimeoutFactory.h" />
<ClInclude Include="..\..\Inc\IPC\Policies\ReceiverFactory.h" />
<ClInclude Include="..\..\Inc\IPC\Policies\ReceiverFactoryFwd.h" />
<ClInclude Include="..\..\Inc\IPC\Policies\ThreadPool.h" />

Просмотреть файл

@ -191,9 +191,6 @@
<ClInclude Include="..\..\Inc\IPC\detail\LockFree\IndexedObjectPool.h">
<Filter>detail\LockFree</Filter>
</ClInclude>
<ClInclude Include="..\..\Inc\IPC\Policies\NullTimeoutFactory.h">
<Filter>Policies</Filter>
</ClInclude>
<ClInclude Include="..\..\Inc\IPC\Policies\ReceiverFactoryFwd.h">
<Filter>Policies</Filter>
</ClInclude>
@ -207,6 +204,9 @@
</ClInclude>
<ClInclude Include="..\..\Inc\IPC\Version.h" />
<ClInclude Include="..\..\Inc\IPC\Transport.h" />
<ClInclude Include="..\..\Inc\IPC\Policies\InfiniteTimeoutFactory.h">
<Filter>Policies</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

Просмотреть файл

@ -1,7 +1,7 @@
#pragma once
#include "IPC/DefaultTraits.h"
#include "IPC/Policies/NullTimeoutFactory.h"
#include "IPC/Policies/InfiniteTimeoutFactory.h"
#include "WaitHandleFactoryMock.h"
#include <exception>
@ -14,7 +14,7 @@ namespace Mocks
{
struct NullTimeoutTraits : DefaultTraits
{
using TimeoutFactory = Policies::NullTimeoutFactory;
using TimeoutFactory = Policies::InfiniteTimeoutFactory;
template <typename Context>
using TransactionManager = Policies::TransactionManager<Context, TimeoutFactory>;