Răsfoiți Sursa

合并futex,pmutex此类地址相关的用户态对象的lwp搜索树头指针

shaojinchun 5 ani în urmă
părinte
comite
d72297af78

+ 1 - 2
components/lwp/lwp.h

@@ -92,8 +92,7 @@ struct rt_lwp
 
     struct rt_wqueue wait_queue; /*for console */
 
-    struct lwp_avl_struct *futex_head;
-    struct lwp_avl_struct *pmutex_head;
+    struct lwp_avl_struct *address_search_head; /* for addressed object fast rearch */
 #ifdef RT_USING_GDBSERVER
     int debug;
     uint32_t bak_first_ins;

+ 3 - 3
components/lwp/lwp_futex.c

@@ -73,11 +73,11 @@ struct rt_futex* futex_create(int *uaddr, struct rt_lwp *lwp)
 
     futex->uaddr = uaddr;
     futex->node.avl_key = (avl_key_t)uaddr;
-    futex->node.data = &lwp->futex_head;
+    futex->node.data = &lwp->address_search_head;
     rt_list_init(&(futex->waiting_thread));
 
     /* insert into futex head */
-    lwp_avl_insert(&futex->node, &lwp->futex_head);
+    lwp_avl_insert(&futex->node, &lwp->address_search_head);
     return futex;
 }
 
@@ -86,7 +86,7 @@ static struct rt_futex* futex_get(void *uaddr, struct rt_lwp *lwp)
     struct rt_futex *futex = RT_NULL;
     struct lwp_avl_struct *node = RT_NULL;
 
-    node = lwp_avl_find((avl_key_t)uaddr, lwp->futex_head);
+    node = lwp_avl_find((avl_key_t)uaddr, lwp->address_search_head);
     if (!node)
     {
         return RT_NULL;

+ 1 - 2
components/lwp/lwp_pid.c

@@ -111,8 +111,7 @@ struct rt_lwp* lwp_new(void)
     pid_struct.pidmap[i] = lwp;
     rt_list_init(&lwp->t_grp);
     rt_list_init(&lwp->object_list);
-    lwp->futex_head = RT_NULL;
-    lwp->pmutex_head = RT_NULL;
+    lwp->address_search_head = RT_NULL;
     rt_wqueue_init(&lwp->wait_queue);
 
     lwp->ref = 1;

+ 3 - 3
components/lwp/lwp_pmutex.c

@@ -81,11 +81,11 @@ static struct rt_pmutex* pmutex_create(void *umutex, struct rt_lwp *lwp)
     }
 
     pmutex->node.avl_key = (avl_key_t)umutex;
-    pmutex->node.data = &lwp->pmutex_head;
+    pmutex->node.data = &lwp->address_search_head;
     pmutex->custom_obj = obj;
 
     /* insert into pmutex head */
-    lwp_avl_insert(&pmutex->node, &lwp->pmutex_head);
+    lwp_avl_insert(&pmutex->node, &lwp->address_search_head);
     return pmutex;
 }
 
@@ -94,7 +94,7 @@ static struct rt_pmutex* pmutex_get(void *umutex, struct rt_lwp *lwp)
     struct rt_pmutex *pmutex = RT_NULL;
     struct lwp_avl_struct *node = RT_NULL;
 
-    node = lwp_avl_find((avl_key_t)umutex, lwp->pmutex_head);
+    node = lwp_avl_find((avl_key_t)umutex, lwp->address_search_head);
     if (!node)
     {
         return RT_NULL;