diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-07-01 22:33:47 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2002-07-01 22:33:47 +0000 |
commit | 3c46587833f88c89314050674a81d8e9ed6e6f80 (patch) | |
tree | f0926bbad67f5213ecbe1d67d20226c2cb6f525e /c/src/exec/posix/src/keycreate.c | |
parent | 2002-07-01 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-3c46587833f88c89314050674a81d8e9ed6e6f80.tar.bz2 |
2002-07-01 Joel Sherrill <joel@OARcorp.com>
* Mega patch merge to change the format of the object IDs to
loosen the dependency between the SCORE and the various APIs.
There was considerable work to simplify the object name management
and it appears that the name_table field is no longer needed.
This patch also includes the addition of the internal mutex
which is currently only used to protect some types of allocation
and deallocation. This significantly can reduce context
switch latency under certain circumstances. In particular,
some heap/region operations were O(n) and had dispatching
disabled. This should help enormously. With this merge,
the patch is not as clean as it should be. In particular,
the documentation has not been modified to reflect the new object
ID layout, the IDs in the test screens are not updated, and
_Objects_Get_information needs to be a real routine not inlined.
As part of this patch a lot of MP code for thread/proxy blocking
was made conditional and cleaned up.
* include/rtems/posix/key.h, src/cond.c, src/condinit.c, src/intr.c,
src/key.c, src/keycreate.c, src/keydelete.c, src/killinfo.c,
src/mqueue.c, src/mqueuecreatesupp.c, src/mutex.c, src/mutexinit.c,
src/psignal.c, src/pthread.c, src/semaphore.c,
src/semaphorecreatesupp.c: Modified as part of above.
Diffstat (limited to 'c/src/exec/posix/src/keycreate.c')
-rw-r--r-- | c/src/exec/posix/src/keycreate.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/c/src/exec/posix/src/keycreate.c b/c/src/exec/posix/src/keycreate.c index bf3f7501cb..bcb881e756 100644 --- a/c/src/exec/posix/src/keycreate.c +++ b/c/src/exec/posix/src/keycreate.c @@ -28,7 +28,7 @@ int pthread_key_create( { POSIX_Keys_Control *the_key; void *table; - unsigned32 the_class; + unsigned32 the_api; unsigned32 bytes_to_allocate; @@ -49,29 +49,30 @@ int pthread_key_create( * for. [NOTE: Currently RTEMS Classic API tasks are not always enabled.] */ - for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS; - the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS; - the_class++ ) { + for ( the_api = 1; + the_api <= OBJECTS_APIS_LAST; + the_api++ ) { - if ( _Objects_Information_table[ the_class ] ) { + if ( _Objects_Information_table[ the_api ] && + _Objects_Information_table[ the_api ][ 1 ] ) { bytes_to_allocate = sizeof( void * ) * - (_Objects_Information_table[ the_class ]->maximum + 1); + (_Objects_Information_table[ the_api ][ 1 ]->maximum + 1); table = _Workspace_Allocate( bytes_to_allocate ); if ( !table ) { - for ( --the_class; - the_class >= OBJECTS_CLASSES_FIRST_THREAD_CLASS; - the_class-- ) - _Workspace_Free( the_key->Values[ the_class ] ); + for ( --the_api; + the_api >= 1; + the_api-- ) + _Workspace_Free( the_key->Values[ the_api ] ); _POSIX_Keys_Free( the_key ); _Thread_Enable_dispatch(); return ENOMEM; } - the_key->Values[ the_class ] = table; + the_key->Values[ the_api ] = table; memset( table, '\0', bytes_to_allocate ); } else { - the_key->Values[ the_class ] = NULL; + the_key->Values[ the_api ] = NULL; } |