This is the mail archive of the
ecos-devel@sources.redhat.com
mailing list for the eCos project.
Re: cyg_thread_kill vs SMP
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: Jonathan Larmour <jifl at eCosCentric dot com>
- Cc: eCos developers <ecos-devel at sources dot redhat dot com>
- Date: 11 Aug 2003 11:47:00 +0100
- Subject: Re: cyg_thread_kill vs SMP
- References: <3F3494C3.3080103@eCosCentric.com>
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