void *auxiliary_thread_launcher_LIN( void *param ) { try { TAuxThreadLaucher *d = reinterpret_cast<TAuxThreadLaucher*>(param); TAuxThreadLaucher localCopy = *d; #ifdef MRPT_OS_WINDOWS // Signal that the thread has started: d->myWindowsId = (unsigned long)GetCurrentThreadId(); d->win_sem.release(); // Our parent thread will release the memory of "param". #else // LINUX: We have to free here this memory: delete d; d = NULL; #endif // Now start the user code: localCopy.ptrFunc( localCopy.param ); } catch(std::exception &e) { std::cout << "Exception in [auxiliary_thread_launcher_LIN/WIN]!!!:\n" << e.what(); } catch(...) { std::cout << "Untyped exception in [auxiliary_thread_launcher_LIN/WIN]!!!\n"; } return NULL; }
void *auxiliary_thread_launcher(void *param) { try { TAuxThreadLaucher *d = reinterpret_cast<TAuxThreadLaucher*>(param); TAuxThreadLaucher localCopy = *d; d->myWindowsId = (unsigned long)GetCurrentThreadId(); d->win_sem.release(); // 启动用户代码 localCopy.ptrFunc(localCopy.param); } catch (std::exception &e) { std::cout << "Exception in [auxiliary_thread_launcher_LIN/WIN]!!!:\n" << e.what(); } catch (...) { std::cout << "Untyped exception in [auxiliary_thread_launcher_LIN/WIN]!!!\n"; } return NULL; }