Triued in vain to fix threads segvs with gcc
Removed wxDebugStream git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -191,21 +191,21 @@ void wxApp::OnIdle( wxIdleEvent &event )
|
||||
{
|
||||
static bool inOnIdle = FALSE;
|
||||
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
/* Avoid recursion (via ProcessEvent default case) */
|
||||
if (inOnIdle)
|
||||
return;
|
||||
|
||||
inOnIdle = TRUE;
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close().
|
||||
/* 'Garbage' collection of windows deleted with Close(). */
|
||||
DeletePendingObjects();
|
||||
|
||||
// flush the logged messages if any
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if (pLog != NULL && pLog->HasPendingMessages())
|
||||
pLog->Flush();
|
||||
/* flush the logged messages if any */
|
||||
wxLog *log = wxLog::GetActiveTarget();
|
||||
if (log != NULL && log->HasPendingMessages())
|
||||
log->Flush();
|
||||
|
||||
// Send OnIdle events to all windows
|
||||
/* Send OnIdle events to all windows */
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
@@ -372,14 +372,6 @@ int wxEntry( int argc, char *argv[] )
|
||||
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
/* Debug stream no longer used
|
||||
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
||||
|
||||
streambuf* sBuf = new wxDebugStreamBuf;
|
||||
ostream* oStr = new ostream(sBuf) ;
|
||||
wxDebugContext::SetStream(oStr, sBuf);
|
||||
#endif
|
||||
*/
|
||||
|
||||
if (!wxTheApp)
|
||||
{
|
||||
@@ -474,7 +466,6 @@ int wxEntry( int argc, char *argv[] )
|
||||
wxDebugContext::Dump();
|
||||
wxDebugContext::PrintStatistics();
|
||||
}
|
||||
// wxDebugContext::SetStream(NULL, NULL);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -160,15 +160,10 @@ void wxThread::OnExit()
|
||||
}
|
||||
|
||||
|
||||
// Automatic initialization
|
||||
class wxThreadModule : public wxModule {
|
||||
DECLARE_DYNAMIC_CLASS(wxThreadModule)
|
||||
public:
|
||||
bool OnInit();
|
||||
void OnExit();
|
||||
};
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
|
||||
|
||||
bool wxThreadModule::OnInit() {
|
||||
bool wxThreadModule::OnInit()
|
||||
{
|
||||
wxMainMutex = new wxMutex();
|
||||
wxMainMutex->Lock();
|
||||
return TRUE;
|
||||
@@ -180,7 +175,7 @@ void wxThreadModule::OnExit()
|
||||
delete wxMainMutex;
|
||||
}
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
|
||||
|
||||
|
||||
void wxMutexGuiEnter()
|
||||
{
|
||||
|
@@ -43,7 +43,7 @@ enum thread_state
|
||||
|
||||
static pthread_t p_mainid;
|
||||
|
||||
wxMutex *wxMainMutex; // controls access to all GUI functions
|
||||
wxMutex *wxMainMutex; /* controls access to all GUI functions */
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// common GUI thread code
|
||||
@@ -182,7 +182,7 @@ void *wxThreadInternal::PthreadStart(void *ptr)
|
||||
{
|
||||
wxThread *thread = (wxThread *)ptr;
|
||||
|
||||
// Call the main entry
|
||||
/* Call the main entry */
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||
void* status = thread->Entry();
|
||||
|
||||
@@ -200,7 +200,7 @@ wxThreadError wxThread::Create()
|
||||
if (p_internal->state != STATE_IDLE)
|
||||
return wxTHREAD_RUNNING;
|
||||
|
||||
// Change thread priority
|
||||
/* Change thread priority */
|
||||
pthread_attr_init(&a);
|
||||
pthread_attr_getschedpolicy(&a, &p);
|
||||
|
||||
@@ -365,7 +365,7 @@ wxThread::~wxThread()
|
||||
delete p_internal;
|
||||
}
|
||||
|
||||
// The default callback just joins the thread and throws away the result.
|
||||
/* The default callback just joins the thread and throws away the result. */
|
||||
void wxThread::OnExit()
|
||||
{
|
||||
Join();
|
||||
@@ -375,28 +375,22 @@ void wxThread::OnExit()
|
||||
// wxThreadModule
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
class wxThreadModule : public wxModule
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxThreadModule)
|
||||
|
||||
public:
|
||||
virtual bool OnInit()
|
||||
{
|
||||
wxMainMutex = new wxMutex();
|
||||
wxThreadGuiInit();
|
||||
p_mainid = pthread_self();
|
||||
wxMainMutex->Lock();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
virtual void OnExit()
|
||||
{
|
||||
wxMainMutex->Unlock();
|
||||
wxThreadGuiExit();
|
||||
delete wxMainMutex;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
|
||||
|
||||
bool wxThreadModule::OnInit()
|
||||
{
|
||||
wxMainMutex = new wxMutex();
|
||||
wxThreadGuiInit();
|
||||
p_mainid = (int)getpid();
|
||||
wxMainMutex->Lock();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxThreadModule::OnExit()
|
||||
{
|
||||
wxMainMutex->Unlock();
|
||||
wxThreadGuiExit();
|
||||
delete wxMainMutex;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -238,21 +238,22 @@ void wxThread::OnExit()
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
class wxThreadModule : public wxModule {
|
||||
DECLARE_DYNAMIC_CLASS(wxThreadModule)
|
||||
public:
|
||||
virtual bool OnInit() {
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
|
||||
|
||||
bool wxThreadModule::OnInit()
|
||||
{
|
||||
wxMainMutex = new wxMutex();
|
||||
wxThreadGuiInit();
|
||||
p_mainid = (int)getpid();
|
||||
wxMainMutex->Lock();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
virtual void OnExit() {
|
||||
void wxThreadModule::OnExit()
|
||||
{
|
||||
wxMainMutex->Unlock();
|
||||
wxThreadGuiExit();
|
||||
delete wxMainMutex;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
|
||||
|
Reference in New Issue
Block a user