-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskSet_CopyMemory.h
More file actions
62 lines (50 loc) · 2.03 KB
/
TaskSet_CopyMemory.h
File metadata and controls
62 lines (50 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
///////////////////////////////////////////////////////////////////////////////
// FILE: TaskSet_CopyMemory.h
// PROJECT: Micro-Manager
// SUBSYSTEM: MMCore
//-----------------------------------------------------------------------------
// DESCRIPTION: Task set for parallelized memory copy.
//
// AUTHOR: Tomas Hanak, tomas.hanak@teledyne.com, 03/03/2021
// Andrej Bencur, andrej.bencur@teledyne.com, 03/03/2021
//
// COPYRIGHT: Teledyne Digital Imaging US, Inc., 2021
//
// LICENSE: This file is distributed under the "Lesser GPL" (LGPL) license.
// License text is included with the source distribution.
//
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
#pragma once
#include "TaskSet.h"
namespace mmcore {
namespace internal {
class TaskSet_CopyMemory : public TaskSet
{
private:
class ATask : public Task
{
public:
explicit ATask(std::shared_ptr<Semaphore> semDone, size_t taskIndex, size_t totalTaskCount);
void SetUp(void* dst, const void* src, size_t bytes, size_t usedTaskCount);
virtual void Execute() override;
private:
void* dst_{ nullptr };
const void* src_{ nullptr };
size_t bytes_{ 0 };
};
public:
explicit TaskSet_CopyMemory(std::shared_ptr<ThreadPool> pool);
void SetUp(void* dst, const void* src, size_t bytes);
virtual void Execute() override;
virtual void Wait() override;
// Helper blocking method calling SetUp, Execute and Wait
void MemCopy(void* dst, const void* src, size_t bytes);
};
} // namespace internal
} // namespace mmcore