This is the mail archive of the ecos-devel@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cyg_thread_kill vs SMP


Jonathan Larmour <jifl@eCosCentric.com> writes:

> Cyg_Thread::kill() contains:
>   switch( sleep_reason ) {
>      case NONE:
>          // The thread is not sleeping for any reason, it must be
>          // on a run queue.
>          // We can safely deschedule and set its state.
>          if( state == RUNNING ) Cyg_Scheduler::scheduler.rem_thread(this);
>          state = EXITED;
>          break;
> 
> Isn't this wrong for SMP?

I think it's OK. rem_thread() will detect that the thread is actually
running on a different CPU and send it a reschedule interrupt. By the
time we come to release the scheduler lock, that other CPU should be
spinning waiting to claim it. The only reason it might not be is if it
is running with interrupts disabled, in which case thread state is
irrelevant, and it will fall in to the reschedule interrupt as soon as
they are re-enabled.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com      The eCos and RedBoot experts


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]