Hi, all.<br>I've a problem of _Thread_Disable_dispatch() function in below code. It's my implementation of _POSIX_Keys_Run_destructors() function. I come across the problem when I run the psxkey03 test:if _Thread_Disable_dispatch() was commented out, psxkey03 can run without problem. when _Thread_Disable_dispatch() added at line 1(as below), psxkey03 will fail. I debug it in sparc-rtems4.11-gdb, and find psxkey03 runs into _Internal_error_Occurred() function then stop. I know _POSIX_Keys_Get()(at line 12) will also disable thread dispatch--does this lead to the problem? However, can't figure out where exactly the problem exists, could anyone explain it? Thanks!<br>
<br><div id=":17i" class="tB"></div>  1 _Thread_Disable_dispatch();<br>  <br>  2 chain = &((POSIX_API_Control *)thread->API_Extensions[ THREAD_API_POSIX ])->the_chain;<br>  3 iter = _Chain_First( chain ); <br>  4 while ( !_Chain_Is_tail( chain, iter ) ) {<br>
  5 next = _Chain_Next( iter );<br>  6  /**<br>  7   * here Chain_Node *iter can be convert to POSIX_Keys_Rbtree_node *,<br>  8   * because Chain_Node is the first member of POSIX_Keys_Rbtree_node structure.<br>  9   */<br>
  10  _RBTree_Extract_unprotected( &_POSIX_Keys_Rbtree, &((POSIX_Keys_Rbtree_node *)iter)->rb_node );<br>  11 _Chain_Extract_unprotected( iter );<br>    <br>  12  the_key = _POSIX_Keys_Get( ((POSIX_Keys_Rbtree_node *)iter)->key, &location);<br>
  13  destructor = the_key->destructor;<br>  14  value = ((POSIX_Keys_Rbtree_node *)iter)->value;<br>  15  if ( destructor != NULL && value != NULL )<br>  16    (*destructor)( value );<br>    <br>  17  _Workspace_Free( (POSIX_Keys_Rbtree_node *)iter );<br>
  18  iter = next;<br>  19}<br><br>  20_Thread_Enable_dispatch();<br><br>---<br>Best regards!<br>Zhongwei Yao<br><br>