diff options
Diffstat (limited to 'sal/osl/unx/thread.c')
-rw-r--r-- | sal/osl/unx/thread.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 1c8fdad8f643..689b78dc748a 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -28,6 +28,9 @@ #include "system.h" #include <string.h> +#if defined(OPENBSD) +#include <sched.h> +#endif #include <osl/diagnose.h> #include <osl/thread.h> #include <osl/nlsupport.h> @@ -280,6 +283,9 @@ static oslThread osl_thread_create_Impl ( short nFlags) { Thread_Impl* pImpl; +#if defined(OPENBSD) + pthread_attr_t attr; +#endif int nRet=0; pImpl = osl_thread_construct_Impl(); @@ -292,9 +298,23 @@ static oslThread osl_thread_create_Impl ( pthread_mutex_lock (&(pImpl->m_Lock)); +#if defined(OPENBSD) + if (pthread_attr_init(&attr) != 0) + return (0); + + if (pthread_attr_setstacksize(&attr, 262144) != 0) { + pthread_attr_destroy(&attr); + return (0); + } +#endif + if ((nRet = pthread_create ( &(pImpl->m_hThread), +#if defined(OPENBSD) + &attr, +#else PTHREAD_ATTR_DEFAULT, +#endif osl_thread_start_Impl, (void*)(pImpl))) != 0) { @@ -307,6 +327,10 @@ static oslThread osl_thread_create_Impl ( return (0); } +#if defined(OPENBSD) + pthread_attr_destroy(&attr); +#endif + /* wait for change from STARTUP to ACTIVE state */ while (pImpl->m_Flags & THREADIMPL_FLAGS_STARTUP) { |