From f8c9e358eca92d5526e5b4a24faf4776aa7faaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Fri, 30 Apr 2010 09:12:41 +0000 Subject: [PATCH] No Multithreading on Windows, refs #4 --- install-64-and-32-bit-linux.sh | 2 +- proxyface/autoproxy.hxx | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/install-64-and-32-bit-linux.sh b/install-64-and-32-bit-linux.sh index 4e620f1..6d3f8a2 100755 --- a/install-64-and-32-bit-linux.sh +++ b/install-64-and-32-bit-linux.sh @@ -7,7 +7,7 @@ make && \ sudo make install && \ make clean && \ LDFLAGS="-L/opt/local/i586-mingw32msvc/lib" \ - CPPFLAGS="-I/opt/local/i586-mingw32msvc/include" \ + CPPFLAGS="-I/opt/local/i586-mingw32msvc/include -DQ_OS_WIN32" \ ./configure \ --prefix=/opt/local/i586-mingw32msvc \ --build=x86_64 \ diff --git a/proxyface/autoproxy.hxx b/proxyface/autoproxy.hxx index a713003..b40317a 100644 --- a/proxyface/autoproxy.hxx +++ b/proxyface/autoproxy.hxx @@ -15,7 +15,9 @@ #include #include #include +#ifndef Q_OS_WIN32 #include +#endif #include #ifndef PROXYFACE_LOG #define PROXYFACE_LOG qDebug()<<__PRETTY_FUNCTION__ @@ -80,7 +82,11 @@ namespace proxy { @example test.cxx */ class Interface #ifdef QT_NETWORK_LIB +#ifdef Q_OS_WIN32 + : public QObject +#else : public QThread +#endif #endif { #ifdef QT_NETWORK_LIB @@ -95,8 +101,10 @@ namespace proxy { qFatal("connect failed"); if (!connect(&_timeout2, SIGNAL(timeout()), SLOT(timeout()))) qFatal("connect failed"); +#ifndef Q_OS_WIN32 if (!connect(this, SIGNAL(finished()), SLOT(threadFinished()))) qFatal("connect failed"); +#endif #endif } virtual ~Interface() {} @@ -245,7 +253,11 @@ namespace proxy { " try autoproxy negotiation"; _direct = false; _url = url; +#ifndef Q_OS_WIN32 start(); // autoproxy detection in own thread +#else + run(); +#endif } else { qDebug()<<"No proxy at all, giving up - offline?"; proxyError(QNetworkReply::TimeoutError); @@ -307,6 +319,9 @@ namespace proxy { void run() { PROXYFACE_LOG; _proxies = proxies(_url); +#ifdef Q_OS_WIN32 + threadFinished(); +#endif } private: typedef std::map