{
if (!initted) return ;
if (external_driving) {
- Sleep(5); //Sleep for 5 ms, in order to avoid blocking the other threads
+ DWORD time1=timeGetTime(); //Updates the Menue
+ if ((time1-lastrendertime)>200) {//5 fps for OSD updates are enough, avoids tearing
+ InternalRendering(NULL);
+ lastrendertime=timeGetTime();
+ } else {
+ Sleep(5); //Sleep for 5 ms, in order to avoid blocking the other threads
+ }
} else {
DWORD time1=timeGetTime();
if ((time1-lastrendertime)>50) {//10 fps for OSD updates are enough, avoids tearing
if (!initted) return;
if (external_driving) {
InternalRendering(present);
+ lastrendertime=timeGetTime();
}
}
CloseHandle(pthread);
CloseHandle(threadCond);
CloseHandle(threadCondMutex);
+ CloseHandle(threadKillable);
}
{
threadCond = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL);
if (threadCond == NULL) return 0;
+ threadKillable = CreateEvent(NULL,/*FALSE*/TRUE,FALSE,NULL);
+ if (threadKillable == NULL) return 0;
threadCondMutex = CreateMutex(NULL,FALSE,NULL);
if (threadCondMutex == NULL)
{
{
CloseHandle(threadCond);
CloseHandle(threadCondMutex);
+ CloseHandle(threadKillable);
return 0;
}
return 1;
void ThreadWin::threadCancel()
{
threadActive = 0;
- //TerminateThread(pthread, 0);
threadSignalNoLock();
- WaitForSingleObject(pthread, INFINITE);
+ HANDLE objs[]={threadKillable,pthread};
+ if (WaitForMultipleObjects(2,objs,FALSE,INFINITE)==WAIT_OBJECT_0) {
+ TerminateThread(pthread, 0);
+ }
this->threadPostStopCleanup();
}
void ThreadWin::threadSetKillable()
{
//WIN32:Ignore or use a separate Event Object to simulate this
+ SetEvent(threadKillable);
}
void ThreadWin::threadSuicide()
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
#include <stdio.h>
#include <stdlib.h>