Changeset 390cfcd in rtems
- Timestamp:
- 08/02/14 13:49:26 (8 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 888edf6
- Parents:
- 60fe374
- git-author:
- Sebastian Huber <sebastian.huber@…> (08/02/14 13:49:26)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (08/05/14 07:30:37)
- Location:
- cpukit/posix
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/posix/include/rtems/posix/key.h
r60fe374 r390cfcd 26 26 #include <rtems/score/object.h> 27 27 #include <rtems/score/rbtree.h> 28 #include <rtems/score/thread.h> 28 29 29 30 #ifdef __cplusplus … … 40 41 41 42 /** 42 * @brief The rbtree node used to manage a POSIX key and value.43 * @brief Represents POSIX key and value pair. 43 44 */ 44 45 typedef struct { 45 /** This field is the chain node structure. */ 46 /** 47 * @brief The chain node for the per-thread value chain. 48 */ 46 49 Chain_Node Key_values_per_thread_node; 47 /** This field is the rbtree node structure. */ 50 51 /** 52 * @brief The tree node for the lookup tree. 53 */ 48 54 RBTree_Node Key_value_lookup_node; 49 /** This field is the POSIX key used as an rbtree key */ 55 56 /** 57 * @brief The POSIX key identifier used in combination with the thread 58 * pointer as the tree key. 59 */ 50 60 pthread_key_t key; 51 /** This field is the Thread id also used as an rbtree key */ 52 Objects_Id thread_id; 53 /** This field points to the POSIX key value of specific thread */ 61 62 /** 63 * @brief The thread pointer used in combination with the POSIX key 64 * identifier as the tree key. 65 */ 66 Thread_Control *thread; 67 68 /** 69 * @brief The thread specific POSIX key value. 70 */ 54 71 const void *value; 55 } 72 } POSIX_Keys_Key_value_pair; 56 73 57 74 /** -
cpukit/posix/include/rtems/posix/keyimpl.h
r60fe374 r390cfcd 171 171 RTEMS_INLINE_ROUTINE RBTree_Node *_POSIX_Keys_Find( 172 172 pthread_key_t key, 173 Objects_Id thread_id,173 Thread_Control *thread, 174 174 POSIX_Keys_Key_value_pair *search_node 175 175 ) 176 176 { 177 177 search_node->key = key; 178 search_node->thread _id = thread_id;178 search_node->thread = thread; 179 179 180 180 return _RBTree_Find( -
cpukit/posix/src/key.c
r60fe374 r390cfcd 52 52 POSIX_Keys_Key_value_pair *n1; 53 53 POSIX_Keys_Key_value_pair *n2; 54 Objects_Id thread_id1, thread_id2; 54 Thread_Control *thread1; 55 Thread_Control *thread2; 55 56 RBTree_Compare_result diff; 56 57 … … 62 63 return diff; 63 64 64 thread _id1 = n1->thread_id;65 thread _id2 = n2->thread_id;65 thread1 = n1->thread; 66 thread2 = n2->thread; 66 67 67 /** 68 * if thread_id1 or thread_id2 equals to 0, only key1 and key2 is valued. 69 * it enables us search node only by pthread_key_t type key. 68 /* 69 * If thread1 or thread2 equals to NULL, only key1 and key2 is valued. It 70 * enables us search node only by pthread_key_t type key. Exploit that the 71 * thread control alignment is at least two to avoid integer overflows. 70 72 */ 71 if ( thread_id1 && thread_id2 ) 72 return thread_id1 - thread_id2; 73 if ( thread1 != NULL && thread2 != NULL ) 74 return (RBTree_Compare_result) ( (uintptr_t) thread1 >> 1 ) 75 - (RBTree_Compare_result) ( (uintptr_t) thread2 >> 1 ); 76 73 77 return 0; 74 78 } -
cpukit/posix/src/keygetspecific.c
r60fe374 r390cfcd 50 50 51 51 case OBJECTS_LOCAL: 52 p = _POSIX_Keys_Find( key, _Thread_Executing ->Object.id, &search_node );52 p = _POSIX_Keys_Find( key, _Thread_Executing, &search_node ); 53 53 if ( p != NULL ) { 54 54 value_pair_p = POSIX_KEYS_RBTREE_NODE_TO_KEY_VALUE_PAIR( p ); -
cpukit/posix/src/keysetspecific.c
r60fe374 r390cfcd 40 40 RBTree_Node *p; 41 41 POSIX_Keys_Key_value_pair search_node; 42 Thread_Control *executing; 42 43 43 44 the_key = _POSIX_Keys_Get( key, &location ); … … 45 46 46 47 case OBJECTS_LOCAL: 47 p = _POSIX_Keys_Find( key, _Thread_Executing->Object.id, &search_node ); 48 executing = _Thread_Executing; 49 p = _POSIX_Keys_Find( key, executing, &search_node ); 48 50 if ( p != NULL ) { 49 51 value_pair_ptr = POSIX_KEYS_RBTREE_NODE_TO_KEY_VALUE_PAIR( p ); … … 59 61 60 62 value_pair_ptr->key = key; 61 value_pair_ptr->thread _id = _Thread_Executing->Object.id;63 value_pair_ptr->thread = executing; 62 64 value_pair_ptr->value = value; 63 65 /* The insert can only go wrong if the same node is already in a unique
Note: See TracChangeset
for help on using the changeset viewer.