GCC Code Coverage Report


Directory: codebase/
File: codebase/interface/include/public/api.Scheduler.hpp
Date: 2023-03-16 04:37:09
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /**
2 * @file api.Scheduler.hpp
3 * @author Sergey Baigudin, sergey@baigudin.software
4 * @copyright 2016-2022, Sergey Baigudin, Baigudin Software
5 */
6 #ifndef API_SCHEDULER_HPP_
7 #define API_SCHEDULER_HPP_
8
9 #include "api.Object.hpp"
10 #include "api.Thread.hpp"
11 #include "api.Task.hpp"
12
13 namespace eoos
14 {
15 namespace api
16 {
17
18 /**
19 * @class Scheduler
20 * @brief Threads scheduler interface.
21 */
22 class Scheduler : public Object
23 {
24
25 public:
26
27 /**
28 * @brief Destructor.
29 */
30 virtual ~Scheduler() = 0;
31
32 /**
33 * @brief Creates a new thread.
34 *
35 * @param task An user task which main function will be invoked when created thread is started.
36 * @return A new thread.
37 */
38 virtual Thread* createThread(Task& task) = 0;
39
40 /**
41 * @brief Causes current thread to sleep.
42 *
43 * @param ms A time to sleep in milliseconds.
44 * @return true if thread slept requested time.
45 */
46 virtual bool_t sleep(int32_t ms) = 0;
47
48 /**
49 * @brief Yields to next thread.
50 */
51 virtual void yield() = 0;
52
53 };
54
55 368 inline Scheduler::~Scheduler() {}
56
57 } // namespace api
58 } // namespace eoos
59 #endif // API_SCHEDULER_HPP_
60