mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-09-21 03:55:48 +02:00
wxgui: Runs games. 'nuff said.
* Fixed some deadlock conditions by adding a message pump to semaphore waits ont he main/gui thread. * Many more config and init bugfixes. * Implemented most of the new Boot menu. git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1745 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
#include "Threading.h"
|
||||
|
||||
#include <wx/datetime.h>
|
||||
#include <wx/thread.h>
|
||||
#include <wx/app.h>
|
||||
|
||||
#ifdef __LINUX__
|
||||
# include <signal.h> // for pthread_kill, which is in pthread.h on w32-pthreads
|
||||
@@ -245,6 +247,28 @@ namespace Threading
|
||||
}
|
||||
#endif
|
||||
|
||||
#if wxUSE_GUI
|
||||
// This is a wxApp-safe implementation of Wait, which makes sure and executes the App's
|
||||
// pending messages *if* the Wait is performed on the Main/GUI thread. If the Wait is
|
||||
// called from another thread, no message pumping is performed.
|
||||
void Semaphore::WaitGui()
|
||||
{
|
||||
if( !wxThread::IsMain() || (wxTheApp == NULL) )
|
||||
Wait();
|
||||
else
|
||||
{
|
||||
// In order to avoid deadlock we need to make sure we cut some time
|
||||
// to handle messages. I choose 200ms:
|
||||
|
||||
static const timespec fail = { 0, 200 * 1000000 };
|
||||
do {
|
||||
|
||||
wxTheApp->ProcessPendingEvents();
|
||||
} while( sem_timedwait( &sema, &fail ) == ETIMEDOUT );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Semaphore::Wait()
|
||||
{
|
||||
sem_wait( &sema );
|
||||
|
||||
Reference in New Issue
Block a user