36 #include <visp3/core/vpConfig.h>
37 #include <visp3/core/vpException.h>
39 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) && (defined(VISP_HAVE_PTHREAD) || (defined(_WIN32) && !defined(WINRT_8_0)))
41 #if defined(VISP_HAVE_PTHREAD)
51 #ifdef ENABLE_VISP_NAMESPACE
67 class VP_DEPRECATED vpThread
70 #if defined(VISP_HAVE_PTHREAD)
73 typedef void *(*Fn)(Args);
74 typedef pthread_t Handle;
78 typedef LPTHREAD_START_ROUTINE Fn;
80 typedef HANDLE Handle;
86 vpThread() : m_handle(), m_isCreated(false), m_isJoinable(false) { }
95 vpThread(vpThread::Fn fn, vpThread::Args args =
nullptr) : m_handle(), m_isCreated(false), m_isJoinable(false)
106 void create(vpThread::Fn fn, vpThread::Args args =
nullptr)
110 #if defined(VISP_HAVE_PTHREAD)
111 int err = pthread_create(&m_handle,
nullptr, fn, args);
115 #elif defined(_WIN32)
116 DWORD dwThreadIdArray;
117 m_handle = CreateThread(
nullptr,
134 #if defined(VISP_HAVE_PTHREAD)
135 #elif defined(_WIN32)
136 CloseHandle(m_handle);
153 #if defined(VISP_HAVE_PTHREAD)
154 pthread_join(m_handle,
nullptr);
155 #elif defined(_WIN32)
156 #if defined(WINRT_8_1)
157 WaitForSingleObjectEx(m_handle, INFINITE, FALSE);
159 WaitForSingleObject(m_handle, INFINITE);
162 m_isJoinable =
false;
170 Handle getHandle() {
return m_handle; }
181 bool joinable() {
return m_isJoinable; }
188 #ifdef ENABLE_VISP_NAMESPACE
error that can be emitted by ViSP classes.
@ cannotUseConstructorError
constructor error