PLCnext API Documentation 25.0.2.69
IoThread.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/PimplPtr.hxx"
9#include "Arp/Base/Core/delegate.hxx"
10
11namespace Arp::Io::Commons
12{
13
25class ARP_EXPORT IoThread
26{
27public: // Impl forward declaration
28 class Impl;
29
30public: // usings
31 using ThreadLoopBodyDelegate = delegate<void(void)>;
32
33public: // canonical construction/destruction/assignment
34 IoThread(const IoThread& arg) = delete;
35 IoThread(IoThread&& arg)noexcept;
36 IoThread& operator=(const IoThread& arg) = delete;
37 IoThread& operator=(IoThread&& arg)noexcept;
38 ~IoThread(void);
39
40public: // construction/destruction/assignment
42 const String& name, // thread name
43 size_t priority, // thread priority, range=0..98
44 Duration cycleTime, // cycle time
45 size_t cpuAffinityMask, // CPU bitmask, 0=unbound, 1=core_1, 2=core_2, 3=core_1or2
46 ThreadLoopBodyDelegate threadLoopBodyDelegate); // delegate to execute the thread loop body in any cycle
47
48public: // setter/getter operations
49 const String& GetName(void)const;
50 size_t GetPriority(void)const;
51 Duration GetCycleTime(void)const;
52 size_t GetCpuAffinityMask(void)const;
53
54public: // operations
55 void Start(void);
56 void Join(bool interrupt = true);
57 void Abort(void);
58
59public: // internal operations
60 Impl& GetImpl(void);
61 const Impl& GetImpl(void)const;
62
63private: // Impl usings
64 using Pimpl = PimplPtr<Impl>;
65
66private: // Impl fields
67 Pimpl pimpl;
68};
69
70} // end of namespace Arp::Io::Commons
Adapter class to implement PImpl idiom.
Definition: PimplPtr.hxx:15
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
Prototyping of delegate template.
Definition: delegate.hxx:14
This class shall be used for fieldbus threads.
Definition: IoThread.hpp:26
~IoThread(void)
The default destructor.
IoThread(IoThread &&arg) noexcept
The default move constructor.
IoThread & operator=(IoThread &&arg) noexcept
The default move-assignment operator.
Definition: Duration.hpp:16
Namespace for interface types of the IO domain