aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/pthread.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-13 00:56:15 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-13 00:56:15 +0000
commit5d409851a35412607aeccef8426f402fbf27a102 (patch)
treea215d7204ea129f65f77405b3e9150c105c2a4e1 /linuxthreads/pthread.c
parent441e41325ef99b5b469ae1291c309769464c5de9 (diff)
downloadglibc-5d409851a35412607aeccef8426f402fbf27a102.zip
glibc-5d409851a35412607aeccef8426f402fbf27a102.tar.gz
glibc-5d409851a35412607aeccef8426f402fbf27a102.tar.bz2
Update.
1998-03-13 00:46 Ulrich Drepper <drepper@cygnus.com> * attr.c: Implement pthread_attr_[gs]etguardsize, pthread_attr_[gs]setstackaddr, pthread_attr_[gs]etstacksize. Change pthread_attr_init to have two interfaces. * internals.h (struct _pthread_descr_struct): Add new fields for above functions. * libpthread.map: Add names in GLIBC_2.1 section. * manager.c (pthread_handle_create): Implement guardsize and user stack. (pthread_free): Likewise. * pthread.c (pthread_create): Add new interface for changed pthread_attr_t. * sysdeps/pthread/pthread.h: Add prototypes for new functions. * sysdeps/unix/sysv/linux/bits/local_lim.h: Add definition of PTHREAD_STACK_MIN. * manager.c: Enable resetting of the thread scheduling policy to SCHED_OTHER when the parent thread has a different one.
Diffstat (limited to 'linuxthreads/pthread.c')
-rw-r--r--linuxthreads/pthread.c50
1 files changed, 48 insertions, 2 deletions
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 994233e..729222e 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -234,8 +234,8 @@ static int pthread_initialize_manager(void)
/* Thread creation */
-int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
- void * (*start_routine)(void *), void *arg)
+int __pthread_create_2_1(pthread_t *thread, const pthread_attr_t *attr,
+ void * (*start_routine)(void *), void *arg)
{
pthread_descr self = thread_self();
struct pthread_request request;
@@ -255,6 +255,35 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
return self->p_retcode;
}
+#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+default_symbol_version (__pthread_create_2_1, pthread_create, GLIBC_2.1);
+
+int __pthread_create_2_0(pthread_t *thread, const pthread_attr_t *attr,
+ void * (*start_routine)(void *), void *arg)
+{
+ /* The ATTR attribute is not really of type `pthread_attr_t *'. It has
+ the old size and access to the new members might crash the program.
+ We convert the struct now. */
+ pthread_attr_t new_attr;
+
+ if (attr != NULL)
+ {
+ size_t ps = __getpagesize ();
+
+ memcpy (&new_attr, attr, (size_t) &(((pthread_attr_t*)NULL)->guardsize));
+ new_attr.guardsize = ps;
+ new_attr.stackaddr_set = 0;
+ new_attr.stackaddr = NULL;
+ new_attr.stacksize = STACK_SIZE - ps;
+ attr = &new_attr;
+ }
+ return __pthread_create_2_1 (thread, attr, start_routine, arg);
+}
+symbol_version (__pthread_create_2_0, pthread_create, GLIBC_2.0);
+#else
+strong_alias (__pthread_create_2_1, pthread_create)
+#endif
+
/* Simple operations on thread identifiers */
pthread_t pthread_self(void)
@@ -417,6 +446,23 @@ void __pthread_kill_other_threads_np(void)
}
weak_alias (__pthread_kill_other_threads_np, pthread_kill_other_threads_np)
+/* Concurrency symbol level. */
+static int current_level;
+
+int __pthread_setconcurrency(int level)
+{
+ /* We don't do anything unless we have found a useful interpretation. */
+ current_level = level;
+ return 0;
+}
+weak_alias (__pthread_setconcurrency, pthread_setconcurrency)
+
+int __pthread_getconcurrency(void)
+{
+ return current_level;
+}
+weak_alias (__pthread_getconcurrency, pthread_getconcurrency)
+
/* Debugging aid */
#ifdef DEBUG