//----------------------------------------------------------------------------- // nulo.h //----------------------------------------------------------------------------- #include #include #include #include //----------------------------------------------------------------------------- #define check(code) docheck(code, __FILE__, __LINE__) int docheck(int error, const char *file, int line) { if (error == -1) { std::cerr << file << ":" << line << ": " << strerror(errno) << std::endl; exit(EXIT_FAILURE); } return error; } //----------------------------------------------------------------------------- void usuario() { boost::fibers::fiber t([] {}); t.join(); } void nucleo() { std::thread t([] {}); t.join(); } void proceso() { switch (check(fork())) { case 0: check(execl("nulo", "nulo", nullptr)); break; default: wait(nullptr); break; } } //-----------------------------------------------------------------------------