summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-06-05 14:45:05 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-06-05 14:45:05 +0000
commit9b4e549729ea5e6217354f1b861bf746b7a3ac33 (patch)
treeb6d412c000ccfdbae93917dbadbc165e62fad829 /cpukit
parentadded comments to to document the definition of posix priority (diff)
downloadrtems-9b4e549729ea5e6217354f1b861bf746b7a3ac33.tar.bz2
renamed Schedule to schedparam in the posix api control information.
reviewed the interpretation of most of the thread attributes.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/posix/src/pthread.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index df85978ea6..7ffa08b065 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -24,7 +24,7 @@
const pthread_attr_t _POSIX_Threads_Default_attributes = {
TRUE, /* is_initialized */
- 0, /* stackaddr */
+ NULL, /* stackaddr */
STACK_MINIMUM_SIZE, /* stacksize */
PTHREAD_SCOPE_PROCESS, /* contentionscope */
PTHREAD_INHERIT_SCHED, /* inheritsched */
@@ -35,7 +35,7 @@ const pthread_attr_t _POSIX_Threads_Default_attributes = {
{ 0L, 0 }, /* ss_replenish_period */
{ 0L, 0 } /* ss_initial_budget */
},
- PTHREAD_CREATE_DETACHED, /* detachstate */
+ PTHREAD_CREATE_JOINABLE, /* detachstate */
1 /* cputime_clock_allowed */
};
@@ -399,7 +399,7 @@ int pthread_getschedparam(
case OBJECTS_LOCAL:
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
*policy = api->schedpolicy;
- *param = api->Schedule;
+ *param = api->schedparam;
_Thread_Enable_dispatch();
return 0;
}
@@ -453,7 +453,7 @@ int pthread_setschedparam(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
api->schedpolicy = policy;
- api->Schedule = *param;
+ api->schedparam = *param;
_Thread_Enable_dispatch();
return 0;
}
@@ -625,7 +625,7 @@ int pthread_create(
char *default_name = "psx";
POSIX_API_Control *api;
int schedpolicy = SCHED_RR;
- struct sched_param schedparams;
+ struct sched_param schedparam;
the_attr = (attr) ? attr : &_POSIX_Threads_Default_attributes;
@@ -634,9 +634,12 @@ int pthread_create(
/*
* Core Thread Initialize insures we get the minimum amount of
- * stack space.
+ * stack space if it is allowed to allocate it itself.
*/
+ if ( the_attr->stackaddr && !_Stack_Is_enough( the_attr->stacksize ) )
+ return EINVAL;
+
#if 0
int schedpolicy;
struct sched_param schedparam;
@@ -659,12 +662,16 @@ int pthread_create(
case PTHREAD_INHERIT_SCHED:
api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ];
schedpolicy = api->schedpolicy;
- schedparams = api->Schedule;
+ schedparam = api->schedparam;
break;
+
case PTHREAD_EXPLICIT_SCHED:
schedpolicy = the_attr->schedpolicy;
- schedparams = the_attr->schedparam;
+ schedparam = the_attr->schedparam;
break;
+
+ default:
+ return EINVAL;
}
/*
@@ -759,8 +766,10 @@ int pthread_create(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- api->Attributes = *the_attr;
+ api->Attributes = *the_attr;
api->detachstate = attr->detachstate;
+ api->schedpolicy = schedpolicy;
+ api->schedparam = schedparam;
_Thread_queue_Initialize(
&api->Join_List,
@@ -771,6 +780,10 @@ int pthread_create(
0
);
+ /*
+ * POSIX threads are allocated and started in one operation.
+ */
+
status = _Thread_Start(
the_thread,
THREAD_START_POINTER,
@@ -789,7 +802,6 @@ int pthread_create(
return EINVAL;
}
-
/*
* Return the id and indicate we successfully created the thread
*/
@@ -799,7 +811,6 @@ int pthread_create(
_Thread_Enable_dispatch();
return 0;
-
}
/*PAGE