//
// FOSA(Frescor Operating System Adaptation layer)
//================================================
-// 26-6-07 SANGORRIN: comment scheduler mutex because signal_set can only be
+// 26-Jun-07 SANGORRIN: comment scheduler mutex because signal_set can only be
// set from the scheduler itself (don't delete because it might be useful in
// the future).
//
-// 25-6-07 SANGORRIN: when posix_appsched_execute_actions had an error the code
+// 25-Jun-07 SANGORRIN: when posix_appsched_execute_actions had an error code
// was wrong. Now we clear actions before (and added destroy operation!), then
// execute scheduler op and then go back to main loop (when error it continued
// executing the rest of actions)
+//
+// 10-Jul-07 SANGORRIN: in the new_thread callback we need to accept the thread
+// before suspend or activate it.
// -----------------------------------------------------------------------
#include "fosa_app_def_sched.h"
CHK(posix_appsched_actions_addreject
(&(sched_actions.actions),event.thread));
} else {
+ // clear actions, we need to accept the thread first
+ CHK(posix_appsched_actions_destroy (&(sched_actions.actions)));
+ CHK(posix_appsched_actions_init(&(sched_actions.actions)));
+ // accept the thread
CHK(posix_appsched_actions_addaccept
(&(sched_actions.actions),event.thread));
// store the memory area in thread-specific data
CHK(pthread_setspecific_for
(schedthreaddata.msg_key,event.thread,call_info));
- // activate the thread unless suspended or already activated
- if (!sched_actions.suspended && !sched_actions.activated) {
+ // and activate or suspend the thread
+ if (sched_actions.suspended) {
+ CHK(posix_appsched_actions_addsuspend
+ (&(sched_actions.actions),event.thread));
+ } else {
CHK(posix_appsched_actions_addactivate
(&(sched_actions.actions),event.thread));
}