5da66be9ff047c9498d8154942727b49b42f4718
3 Copyright (C) 2011 Grame
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France
30 //_____________________________________________________________________
31 static DWORD WINAPI
baseThreadProc (LPVOID ptr
)
33 TThreads
* thread
= (TThreads
*)ptr
;
34 thread
->running (true);
36 thread
->running (false);
40 //_____________________________________________________________________
41 TThreads::TThreads () : fThread(0) {}
43 //_____________________________________________________________________
44 int TThreads::SetPriority (int priority
)
46 if (!SetThreadPriority (fThread
, priority
))
51 //_____________________________________________________________________
52 bool TThreads::start (int priority
)
55 fThread
= CreateThread(NULL
, 0, baseThreadProc
, this, 0, &id
);
57 SetPriority (priority
);
63 //_____________________________________________________________________
64 void TThreads::quit ()
67 WaitForSingleObject (fThread
, 1000);
68 CloseHandle (fThread
);