mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 01:57:14 +02:00
check for sysconf (_SC_THREAD_STACK_MIN), which returns the minimal stack
2000-02-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gthread-posix.c, gthread-solaris.c: check for sysconf (_SC_THREAD_STACK_MIN), which returns the minimal stack size for new threads. Patch from Soeren Sandmann <sandmann@daimi.au.dk>.
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
4a3f7e3b42
commit
ac6c1d7c59
@@ -1,3 +1,9 @@
|
|||||||
|
2000-02-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gthread-posix.c, gthread-solaris.c: check for sysconf
|
||||||
|
(_SC_THREAD_STACK_MIN), which returns the minimal stack size for
|
||||||
|
new threads. Patch from Soeren Sandmann <sandmann@daimi.au.dk>.
|
||||||
|
|
||||||
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* gthread-posix.c, gthread-solaris.c: Changed the prototype of
|
* gthread-posix.c, gthread-solaris.c: Changed the prototype of
|
||||||
|
@@ -103,8 +103,8 @@ g_thread_init (GThreadFunctions* init)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* now do any initialization stuff required by the implementation,
|
/* now do any initialization stuff required by the implementation,
|
||||||
but only if called with a NULL argument, of course. Otherwise it's
|
* but only if called with a NULL argument, of course. Otherwise
|
||||||
up to the user to do do. */
|
* it's up to the user to do so. */
|
||||||
|
|
||||||
#ifdef HAVE_G_THREAD_IMPL_INIT
|
#ifdef HAVE_G_THREAD_IMPL_INIT
|
||||||
if (g_thread_use_default_impl)
|
if (g_thread_use_default_impl)
|
||||||
|
@@ -37,6 +37,9 @@
|
|||||||
#ifdef HAVE_SYS_TIME_H
|
#ifdef HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define posix_print_error( name, num ) \
|
#define posix_print_error( name, num ) \
|
||||||
g_error( "file %s: line %d (%s): error %s during %s", \
|
g_error( "file %s: line %d (%s): error %s during %s", \
|
||||||
@@ -64,12 +67,17 @@
|
|||||||
# error This should not happen. Contact the GLib team.
|
# error This should not happen. Contact the GLib team.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gulong g_thread_min_stack_size = 0;
|
||||||
|
|
||||||
#define HAVE_G_THREAD_IMPL_INIT
|
#define HAVE_G_THREAD_IMPL_INIT
|
||||||
static void
|
static void
|
||||||
g_thread_impl_init()
|
g_thread_impl_init()
|
||||||
{
|
{
|
||||||
g_thread_min_priority = POSIX_MIN_PRIORITY;
|
g_thread_min_priority = POSIX_MIN_PRIORITY;
|
||||||
g_thread_max_priority = POSIX_MAX_PRIORITY;
|
g_thread_max_priority = POSIX_MAX_PRIORITY;
|
||||||
|
#ifdef _SC_THREAD_STACK_MIN
|
||||||
|
g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0);
|
||||||
|
#endif /* _SC_THREAD_STACK_MIN */
|
||||||
}
|
}
|
||||||
|
|
||||||
static GMutex *
|
static GMutex *
|
||||||
@@ -228,7 +236,10 @@ g_thread_create_posix_impl (GThreadFunc thread_func,
|
|||||||
|
|
||||||
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
||||||
if (stack_size)
|
if (stack_size)
|
||||||
|
{
|
||||||
|
stack_size = MAX (g_thread_min_stack_size, stack_size);
|
||||||
posix_check_for_error (pthread_attr_setstacksize (&attr, stack_size));
|
posix_check_for_error (pthread_attr_setstacksize (&attr, stack_size));
|
||||||
|
}
|
||||||
#endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
|
#endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
|
||||||
|
|
||||||
#ifdef PTHREAD_SCOPE_SYSTEM
|
#ifdef PTHREAD_SCOPE_SYSTEM
|
||||||
|
@@ -35,6 +35,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define solaris_print_error( name, num ) \
|
#define solaris_print_error( name, num ) \
|
||||||
g_error( "file %s: line %d (%s): error %s during %s", \
|
g_error( "file %s: line %d (%s): error %s during %s", \
|
||||||
@@ -46,12 +49,17 @@
|
|||||||
if( error ) { solaris_print_error( what, error ); } \
|
if( error ) { solaris_print_error( what, error ); } \
|
||||||
}G_STMT_END
|
}G_STMT_END
|
||||||
|
|
||||||
|
gulong g_thread_min_stack_size = 0;
|
||||||
|
|
||||||
#define HAVE_G_THREAD_IMPL_INIT
|
#define HAVE_G_THREAD_IMPL_INIT
|
||||||
static void
|
static void
|
||||||
g_thread_impl_init()
|
g_thread_impl_init()
|
||||||
{
|
{
|
||||||
g_thread_min_priority = 0;
|
g_thread_min_priority = 0;
|
||||||
g_thread_max_priority = 127;
|
g_thread_max_priority = 127;
|
||||||
|
#ifdef _SC_THREAD_STACK_MIN
|
||||||
|
g_thread_min_stack_size = MAX (sysconf (_SC_THREAD_STACK_MIN), 0);
|
||||||
|
#endif /* _SC_THREAD_STACK_MIN */
|
||||||
}
|
}
|
||||||
|
|
||||||
static GMutex *
|
static GMutex *
|
||||||
@@ -193,6 +201,8 @@ g_thread_create_solaris_impl (GThreadFunc thread_func,
|
|||||||
|
|
||||||
g_return_if_fail (thread_func);
|
g_return_if_fail (thread_func);
|
||||||
|
|
||||||
|
stack_size = MAX (g_thread_min_stack_size, stack_size);
|
||||||
|
|
||||||
solaris_check_for_error (thr_create (NULL, stack_size,
|
solaris_check_for_error (thr_create (NULL, stack_size,
|
||||||
(void* (*)(void*))thread_func,
|
(void* (*)(void*))thread_func,
|
||||||
arg, flags, thread));
|
arg, flags, thread));
|
||||||
|
Reference in New Issue
Block a user