You could use non-blocking IO instead of threads.
In reply to Re: Threads and HTTPS Segfault by moritz in thread Threads and HTTPS Segfault by onelesd