5 * Created by Toshi Nagata on 09/10/21.
6 * Copyright 2009 Toshi Nagata. All rights reserved.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation version 2 of the License.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
21 MyThread::DetachNewThread(int (*entry_func)(void *, int), int (*exit_func)(void *, int), void *argptr, int argnum)
24 MyThread *thread = new MyThread();
26 return wxTHREAD_NO_RESOURCE;
27 thread->m_entry_func = entry_func;
28 thread->m_exit_func = exit_func;
29 thread->m_argptr = argptr;
30 thread->m_argnum = argnum;
31 if ((err = thread->Create()) != wxTHREAD_NO_ERROR)
39 ExitCode code = (ExitCode)(intptr_t)((*m_entry_func)(m_argptr, m_argnum));
41 (*m_exit_func)(m_argptr, m_argnum);
43 return (MyThread::ExitCode)code;