This file contains 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 <thread> | |
#include <condition_variable> | |
class Worker { | |
public: | |
Worker() { | |
start(); | |
} | |
~Worker() { |
This file contains 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
# -*- coding: utf-8 -*- | |
import threading | |
import time | |
class Worker(object): | |
def __init__(self): | |
self._stop_event = threading.Event() | |
self._thread = threading.Thread(target=self.run, args=()) | |
# important otherwise never stops when run() gets stuck!! |
This file contains 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 <iostream> | |
#include <iomanip> | |
#include <chrono> | |
#define Color_Off "\033[0m" | |
#define Black "\033[1;30m" | |
#define Red "\033[1;31m" | |
#define Green "\033[1;32m" | |
#define Yellow "\033[1;33m" | |
#define Blue "\033[1;34m" |