File: detach.cpp

package info (click to toggle)
yrmcds 1.0.4-6
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 924 kB
  • ctags: 1,346
  • sloc: cpp: 9,634; sh: 133; makefile: 97
file content (14 lines) | stat: -rw-r--r-- 193 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <thread>
#include <iostream>

void f() {
    char c;
    std::cin >> c;
}

int main() {
    std::thread t(f);
    t.detach();
    std::cout << "detached" << std::endl;
    return 0;
}