PConcurrentThread.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
17 #pragma once
18 #include <PObject.h>
19 
20 PAPILLON_BEGIN_NAMESPACE
21 
29 class PRunnable
30 {
31 public:
35  virtual ~PRunnable() {}
36 
72  virtual void Run() = 0;
73 };
74 
75 
87 class PAPILLON_API_CORE PConcurrentThread : public PObject
88 {
89 public:
94 
99  PConcurrentThread(void (*f)());
100 
106 
110  PConcurrentThread(const PConcurrentThread& other);
111 
115  virtual ~PConcurrentThread();
116 
120  PConcurrentThread& operator=(const PConcurrentThread& other);
121 
125  void Join();
126 
131  PResult TryJoin(papillon::int32 timeMs);
132 
136  static papillon::uint64 GetThreadId();
137 
141  static void Sleep(papillon::int32 timeMs);
142 
147  static papillon::int32 GetNumAvailableHardwareThreads();
148 
154  static papillon::int32 GetNumAvailableHardwareCores();
155 
156 };
157 
158 PAPILLON_END_NAMESPACE
virtual void Run()=0
When an object implementing interface PRunnable is used to create a thread, starting the thread cause...
The PRunnable class is an interface to inherit to get a task that will be executed by a concurrent th...
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PObject: the root class of all Papillon classes.
The PConcurrentThread class represents a thread, a sequence of instructions that can be executed conc...
virtual ~PRunnable()
Destroys this object.