| 47 | } |
| 48 | |
| 49 | void tbb_thread_v3::join() |
| 50 | { |
| 51 | if (!joinable()) |
| 52 | handle_perror( EINVAL, "tbb_thread::join" ); // Invalid argument |
| 53 | if (this_tbb_thread::get_id() == get_id()) |
| 54 | handle_perror( EDEADLK, "tbb_thread::join" ); // Resource deadlock avoided |
| 55 | #if _WIN32||_WIN64 |
| 56 | #if __TBB_WIN8UI_SUPPORT |
| 57 | std::thread* thread_tmp=(std::thread*)my_thread_id; |
| 58 | thread_tmp->join(); |
| 59 | delete thread_tmp; |
| 60 | #else // __TBB_WIN8UI_SUPPORT |
| 61 | DWORD status = WaitForSingleObjectEx( my_handle, INFINITE, FALSE ); |
| 62 | if ( status == WAIT_FAILED ) |
| 63 | handle_win_error( GetLastError() ); |
| 64 | BOOL close_stat = CloseHandle( my_handle ); |
| 65 | if ( close_stat == 0 ) |
| 66 | handle_win_error( GetLastError() ); |
| 67 | my_thread_id = 0; |
| 68 | #endif // __TBB_WIN8UI_SUPPORT |
| 69 | #else |
| 70 | int status = pthread_join( my_handle, NULL ); |
| 71 | if( status ) |
| 72 | handle_perror( status, "pthread_join" ); |
| 73 | #endif // _WIN32||_WIN64 |
| 74 | my_handle = 0; |
| 75 | } |
| 76 | |
| 77 | void tbb_thread_v3::detach() { |
| 78 | if (!joinable()) |
no test coverage detected