[X2Go-Dev] [PATCH] Fix threading on OS X.

Mihai Moldovan ionic at ionic.de
Sat Feb 18 04:57:52 CET 2012


Raise the stack space to 2MB for secondary threads. It previously used
the 512KB system default.

Signed-off-by: Mihai Moldovan <ionic at ionic.de>
---
 sshmasterconnection.cpp |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/sshmasterconnection.cpp b/sshmasterconnection.cpp
index c922af2..2626346 100644
--- a/sshmasterconnection.cpp
+++ b/sshmasterconnection.cpp
@@ -46,6 +46,11 @@ static bool isLibSshInited=false;
 SshMasterConnection::SshMasterConnection ( QString host, int port, bool
acceptUnknownServers, QString user,
         QString pass, QString key,bool autologin, bool krblogin,
QObject* parent ) : QThread ( parent )
 {
+#if defined ( Q_OS_DARWIN )
+    // Mac OS X provides only 512KB stack space for secondary threads.
+    // As we put a 512KB buffer on the stack later on, we need a bigger
stack space.
+    setStackSize (sizeof (char) * 1024 * 1024 * 2);
+#endif
     this->host=host;
     this->port=port;
     this->user=user;
@@ -62,7 +67,7 @@ SshMasterConnection::SshMasterConnection ( QString
host, int port, bool acceptUn
     else
         x2goDebug<<"starting ssh connection without kerberos
authentication"<<endl;
 #endif
-kerberos=false;
+    kerberos=false;
 }
 
 SshMasterConnection::SshMasterConnection ( QString host, int port, bool
acceptUnknownServers, QString user,
@@ -70,7 +75,9 @@ SshMasterConnection::SshMasterConnection ( QString
host, int port, bool acceptUn
         int remotePort, QString localHost, int localPort, SshProcess*
creator,
         QObject* parent, ONMainWindow* mwd ) : QThread ( parent )
 {
-
+#if defined ( Q_OS_DARWIN )
+    setStackSize (sizeof (char) * 1024 * 1024 * 2);
+#endif
     this->host=host;
     this->port=port;
     this->user=user;
-- 
1.7.9

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4369 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.x2go.org/pipermail/x2go-dev/attachments/20120218/3505268c/attachment.bin>


More information about the x2go-dev mailing list