2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
liblscp - LinuxSampler Control Protocol API |
liblscp - LinuxSampler Control Protocol API |
5 |
Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
7 |
This library is free software; you can redistribute it and/or |
This library is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU Lesser General Public |
modify it under the terms of the GNU Lesser General Public |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 |
Lesser General Public License for more details. |
Lesser General Public License for more details. |
16 |
|
|
17 |
You should have received a copy of the GNU Lesser General Public |
You should have received a copy of the GNU General Public License along |
18 |
License along with this library; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
142 |
// fprintf(stderr, "lscp_thread_cancel: pThread=%p.\n", pThread); |
// fprintf(stderr, "lscp_thread_cancel: pThread=%p.\n", pThread); |
143 |
|
|
144 |
#if defined(WIN32) |
#if defined(WIN32) |
145 |
if (pThread->hThread && TerminateThread(pThread->hThread, 0)) { |
if (pThread->hThread) { // Should we TerminateThread(pThread->hThread, 0) ? |
146 |
pThread->hThread = NULL; |
/* pThread->hThread = NULL; */ |
147 |
ret = LSCP_OK; |
ret = LSCP_OK; |
148 |
} |
} |
149 |
#else |
#else |
159 |
|
|
160 |
lscp_status_t lscp_thread_destroy ( lscp_thread_t *pThread ) |
lscp_status_t lscp_thread_destroy ( lscp_thread_t *pThread ) |
161 |
{ |
{ |
162 |
lscp_status_t ret = lscp_thread_join(pThread); |
lscp_status_t ret = lscp_thread_cancel(pThread); |
163 |
|
|
164 |
|
if (ret == LSCP_OK) |
165 |
|
ret = lscp_thread_join(pThread); |
166 |
|
|
167 |
// fprintf(stderr, "lscp_thread_destroy: pThread=%p.\n", pThread); |
// fprintf(stderr, "lscp_thread_destroy: pThread=%p.\n", pThread); |
168 |
|
|
169 |
if (ret == LSCP_OK) |
if (ret == LSCP_OK) |