xtd 1.0.0
Loading...
Searching...
No Matches
task_object.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../../object.hpp"
6#include "../../usize.hpp"
7#include <atomic>
8
10namespace xtd {
12 namespace threading {
14 namespace tasks {
28 class task_object : public object {
30 protected:
31 inline static thread_local xtd::usize current_id_ = 0;
32 inline static std::atomic<xtd::usize> last_id_ = 0;
33 inline static std::atomic<xtd::usize> last_unique_id_ = 0;
34
35 task_object() = default;
36
37 static auto generate_id() noexcept -> xtd::usize {return last_id_++;}
38 static auto generate_unique_id() noexcept -> xtd::usize {return
39 last_unique_id_++;}
41 };
42 }
43 }
44}
object()=default
Create a new instance of the ultimate base class object.
Represents an asynchronous operation object.
Definition task_object.hpp:28
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
The xtd::threading::tasks namespace provides types that simplify the work of writing concurrent and a...
Definition itask.hpp:14
The xtd::threading namespace provides classes and interfaces that enable multithreaded programming....
Definition abandoned_mutex_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::object class.
Contains xtd::usize type.