Advertisement
obernardovieira

Socket functions test (Linux)

Jul 10th, 2014
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <pthread.h>
  3. using namespace std;
  4.  
  5. void* print_message(void*) {
  6.  
  7.     cout << "Threading\n";
  8. }
  9.  
  10. int main() {
  11.  
  12.     pthread_t t1;
  13.  
  14.     pthread_create(&t1, NULL, &print_message, NULL);
  15.     cout << "Hello";
  16.  
  17.     // Optional.
  18.     void* result;
  19.     pthread_join(t1,&result);
  20.     // :~
  21.  
  22.     return 0;
  23. }
  24.  
  25. //g++ pthread.cpp -lpthread -o pthread
  26. //./pthread
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement