| 109 | } |
| 110 | |
| 111 | void Thread::stop() |
| 112 | { |
| 113 | CE_ASSERT(_priv->_is_running, "Thread is not running"); |
| 114 | |
| 115 | #if CROWN_PLATFORM_WINDOWS |
| 116 | WaitForSingleObject(_priv->handle, INFINITE); |
| 117 | GetExitCodeThread(_priv->handle, (DWORD *)&_priv->_exit_code); |
| 118 | CloseHandle(_priv->handle); |
| 119 | _priv->handle = INVALID_HANDLE_VALUE; |
| 120 | #else |
| 121 | void *retval; |
| 122 | int err = pthread_join(_priv->handle, &retval); |
| 123 | CE_ASSERT(err == 0, "pthread_join: errno = %d", err); |
| 124 | CE_UNUSED(err); |
| 125 | _priv->_exit_code = (s32)(uintptr_t)retval; |
| 126 | _priv->handle = 0; |
| 127 | #endif |
| 128 | |
| 129 | _priv->_is_running = false; |
| 130 | } |
| 131 | |
| 132 | bool Thread::is_running() |
| 133 | { |
no outgoing calls