Hi,
Related to post
http://ecos.sourceware.org/ml/ecos-discuss/2010-04/msg00026.html, here
is a possible small patch to avoid thread "hanging" situation on SMP
targets. It can be easily reproduced using the FreeBSD network stack and
HTTPD packages. Call to cyg_thread_self() in spl_any()
(packages\net\bsd_tcpip\current\src\ecos\synchc) can return wrong value.
Regards,
Christophe
diff -r 418d34334c77 packages/kernel/current/include/sched.hxx
--- a/packages/kernel/current/include/sched.hxx Thu Apr 01 13:17:10 2010 +0000
+++ b/packages/kernel/current/include/sched.hxx Fri Apr 23 11:14:11 2010 +0200
@@ -358,7 +358,24 @@
inline Cyg_Thread *Cyg_Scheduler_Base::get_current_thread()
{
- return current_thread[CYG_KERNEL_CPU_THIS()];
+#ifdef CYGPKG_KERNEL_SMP_SUPPORT
+
+ cyg_uint32 istate;
+ Cyg_Thread * self;
+
+ HAL_DISABLE_INTERRUPTS( istate );
+
+ self = current_thread[CYG_KERNEL_CPU_THIS()];
+
+ HAL_RESTORE_INTERRUPTS( istate );
+
+ return self;
+
+#else
+
+ return current_thread[CYG_KERNEL_CPU_THIS()];
+
+#endif
}
inline void Cyg_Scheduler_Base::set_current_thread(Cyg_Thread *thread )