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 <cstdlib> | |
#include <unistd.h> | |
#include <cstring> | |
#include <cerrno> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
void parent_process_callback() { | |
std::cout <<__func__ <<", pid: " <<getpid() <<std::endl; |
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 <boost/chrono/chrono.hpp> | |
#include <boost/thread/thread.hpp> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
#include <sys/types.h> | |
static pid_t child_pid = 0; | |
void child_process_thread_func() { |
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 <boost/variant.hpp> | |
#include <string> | |
#include <iostream> | |
using data_t = boost::variant< | |
bool, | |
int8_t, | |
uint8_t, | |
int16_t, | |
uint16_t, |
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> | |
//using namespace std::cout; | |
class Subject | |
{ | |
public: | |
Subject() { | |
std::cout <<__func__ <<"@LINE#" <<__LINE__ <<std::endl; | |
} |
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 <boost/thread.hpp> | |
using std::cout; | |
using std::endl; | |
void sayHello() { | |
int32_t cnt = 0; | |
while (!boost::this_thread::interruption_requested()) { |
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
// | |
// Created by kang on 2019-04-19. | |
// | |
#include <chrono> | |
#include <iostream> | |
#include "interrupt_sleep.h" | |
using namespace std::chrono; |
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 <string> | |
#include <sstream> | |
#include <iostream> | |
int getIP(std::string ip_str) { | |
if (ip_str.empty()) { | |
return 0; | |
} | |
std::stringstream ss(ip_str); |
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 <cstdlib> | |
#include <cstdio> | |
#include <string> | |
std::string exec_cmd(std::string cmd) { | |
if (cmd.empty()) { | |
return ""; | |
} |