disable thread dispatch problem
Ashi
ashi08104 at gmail.com
Fri Jul 6 09:49:59 UTC 2012
Hi, all.
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!
1 _Thread_Disable_dispatch();
2 chain = &((POSIX_API_Control *)thread->API_Extensions[ THREAD_API_POSIX
])->the_chain;
3 iter = _Chain_First( chain );
4 while ( !_Chain_Is_tail( chain, iter ) ) {
5 next = _Chain_Next( iter );
6 /**
7 * here Chain_Node *iter can be convert to POSIX_Keys_Rbtree_node *,
8 * because Chain_Node is the first member of POSIX_Keys_Rbtree_node
structure.
9 */
10 _RBTree_Extract_unprotected( &_POSIX_Keys_Rbtree,
&((POSIX_Keys_Rbtree_node *)iter)->rb_node );
11 _Chain_Extract_unprotected( iter );
12 the_key = _POSIX_Keys_Get( ((POSIX_Keys_Rbtree_node *)iter)->key,
&location);
13 destructor = the_key->destructor;
14 value = ((POSIX_Keys_Rbtree_node *)iter)->value;
15 if ( destructor != NULL && value != NULL )
16 (*destructor)( value );
17 _Workspace_Free( (POSIX_Keys_Rbtree_node *)iter );
18 iter = next;
19}
20_Thread_Enable_dispatch();
---
Best regards!
Zhongwei Yao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120706/22910ef2/attachment.html>
More information about the devel
mailing list