Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Multithreading and wxURL.GetInputStream()

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Multithreading and wxURL.GetInputStream()
#2719
Posted by: 2003-10-09 01:41:34
Hi!

I have a problem launching a wxURL.GetInputStream() in a separate thread.
In fact, it hangs as soon as this member is called inside  a created thread.
But it works very well if it called inside the main thread.

Here is the problematic source (tested under wxWindows 2.4):

#include "wx/wx.h"
#include "wx/url.h"

class ThreadRecherche : public wxThread
{
public:
   virtual void * Entry();
};

void * ThreadRecherche::Entry()
{
   wxLogMessage("1");
   wxURL url("http://www.google.com");
   wxLogMessage("2");
   wxInputStream * pFlotSourceHTML;
   wxLogMessage("3");
   pFlotSourceHTML = url.GetInputStream();
   wxLogMessage("4");

   return NULL;
}

class MyApp : public wxApp
{
public:
    virtual bool OnInit();
};

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
   wxLogMessage("We launch the thread");

   ThreadRecherche * pThreadRecherche = new ThreadRecherche();
   pThreadRecherche->Create();
   pThreadRecherche->Run();
  
   wxLogMessage("We quit the application");
  
    return TRUE;
}

With that, I juste get the numbers 1, 2 and 3 in the log window...

Can anyone help me?
Thanks!
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0