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:
Jake.Stine
2009-09-05 23:07:23 +00:00
parent 163efebb29
commit 9308d86ffc
27 changed files with 494 additions and 239 deletions
+24
View File
@@ -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 );