-
Notifications
You must be signed in to change notification settings - Fork 7
process id
Alairion edited this page May 8, 2021
·
3 revisions
Defined in header <nes/process.hpp>
class process
{
public:
struct id{};
}
nes::process::id
is a trivially copyable type that serves as a unique identifier of a process within the system.
(1) constexpr bool operator==(process::id lhs, process::id rhs) noexcept;
(2) constexpr bool operator!=(process::id lhs, process::id rhs) noexcept;
(3) constexpr bool operator<(process::id lhs, process::id rhs) noexcept;
(4) constexpr bool operator<=(process::id lhs, process::id rhs) noexcept;
(5) constexpr bool operator>(process::id lhs, process::id rhs) noexcept;
(6) constexpr bool operator>=(process::id lhs, process::id rhs) noexcept;
template<typename CharT, typename Traits>
(7) std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, nes::process::id id);
- Checks whether
lhs
andrhs
represent the same process. - Checks whether
lhs
andrhs
do not represent the same process. - Compares
lhs
andrhs
in such a way, thatlhs
andrhs
are totally ordered. - Compares
lhs
andrhs
in such a way, thatlhs
andrhs
are totally ordered. - Compares
lhs
andrhs
in such a way, thatlhs
andrhs
are totally ordered. - Compares
lhs
andrhs
in such a way, thatlhs
andrhs
are totally ordered. - Writes a textual representation of a process identifier in
os
.
namespace std
{
template<>
(1) struct hash<nes::process::id>;
}
- Template specialization of
std::hash
fornes::process::id
.
Here is an example in which we display the current process id.
#include <iostream>
#include <nes/process.hpp>
int main()
{
//nes::this_process::get_id() returns the calling process's id.
std::cout << "Current process has id " << nes::this_process::get_id() << std::endl;
}
Current process has id 42