[rtems commit] posix: Fix pthread_create()
Sebastian Huber
sebh at rtems.org
Fri Jun 24 08:30:21 UTC 2016
Module: rtems
Branch: master
Commit: 51e008dda169dcfed0cfb2d64328811107974845
Changeset: http://git.rtems.org/rtems/commit/?id=51e008dda169dcfed0cfb2d64328811107974845
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Jun 23 11:49:22 2016 +0200
posix: Fix pthread_create()
Do not access data of the executing thread without proper locks.
---
cpukit/posix/src/pthreadcreate.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 54b6a71..411882d 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -27,6 +27,7 @@
#include <rtems/posix/priorityimpl.h>
#include <rtems/posix/pthreadimpl.h>
+#include <rtems/score/assert.h>
#include <rtems/score/cpusetimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/apimutex.h>
@@ -103,7 +104,6 @@ int pthread_create(
#endif
executing = _Thread_Get_executing();
- scheduler = _Scheduler_Get_own( executing );
/*
* P1003.1c/Draft 10, p. 121.
@@ -115,9 +115,12 @@ int pthread_create(
*/
switch ( the_attr->inheritsched ) {
case PTHREAD_INHERIT_SCHED:
- api = executing->API_Extensions[ THREAD_API_POSIX ];
- schedpolicy = api->Attributes.schedpolicy;
- schedparam = api->Attributes.schedparam;
+ error = pthread_getschedparam(
+ pthread_self(),
+ &schedpolicy,
+ &schedparam
+ );
+ _Assert( error == 0 );
break;
case PTHREAD_EXPLICIT_SCHED:
More information about the vc
mailing list