This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mutex> | |
#include <thread> | |
#include <unordered_map> | |
std::size_t get_thread_id() noexcept { | |
static std::size_t thread_idx = 0; | |
static std::mutex thread_mutex; | |
static std::unordered_map<std::thread::id, std::size_t> thread_ids; | |
std::lock_guard<std::mutex> lock(thread_mutex); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tasks: 310 total, 5 running, 302 sleeping, 0 stopped, 1 zombie | |
Mem: 468960k total, 459408k used, 9552k free, 2300k buffers | |
Swap: 262140k total, 118768k used, 143372k free, 178380k cached | |
400%cpu 5%user 6%nice 28%sys 359%idle 2%iow 0%irq 1%sirq 0%host | |
PID USER PR NI VIRT RES SHR S[%CPU] %MEM TIME+ ARGS | |
515 system 18 -2 867M 46M 32M S 27.1 10.1 4:35.40 system_server | |
4861 shell 20 0 5.7M 1.8M 1.1M R 5.3 0.3 0:03.87 top | |
350 system 20 0 8.0M 760K 592K S 1.5 0.1 0:01.94 [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
class CarDoor { | |
public: | |
explicit CarDoor(const std::string& name) : mName(name) { } | |
~CarDoor() = default; | |
// Let's imagine a lot of functions here |
NewerOlder