This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: Task suspension and resumption in POSIX
- From: "Ali, Khurram" <Khurram_Ali at mentorg dot com>
- To: "Nick Garnett" <nickg at ecoscentric dot com>
- Cc: <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 8 Apr 2005 11:18:46 -0500
- Subject: RE: [ECOS] Task suspension and resumption in POSIX
Thank you for the quick reply.
I actually just want to do a self-suspend. And another task resumes the
suspended task.
I added the following functions in thread.cxx. It suspends. Just does
not resume!
//----------------------------------------------------------------------
----
// Suspend thread.
externC int pthread_suspend ( void )
{
PTHREAD_ENTRY();
pthread_info *info = pthread_self_info();
// suspend the thread.
info->thread->suspend();
return ( 0 );
}
//----------------------------------------------------------------------
----
// Resume thread.
externC int pthread_resume ( pthread_t thread1 )
{
PTHREAD_ENTRY();
pthread_info *info = pthread_info_id( thread1 );
//resume thread.
if(info != NULL)
{
info->thread->resume();
return ( 0 );
}
else
return ( -1 );
}
Thank you,
Khurram
-----Original Message-----
From: nickg@xl5.calivar.com [mailto:nickg@xl5.calivar.com] On Behalf Of
Nick Garnett
Sent: Friday, April 08, 2005 11:09 AM
To: Ali, Khurram
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Task suspension and resumption in POSIX
"Ali, Khurram" <Khurram_Ali@mentorg.com> writes:
> Hello,
>
> I have two questions:
>
> 1) I am trying to suspend resume posix threads. I do not see the
signals
> for suspending and resuming threads in POSIX. Any ideas on how I can
> suspend the threads?
These are not implemented, they are part of the job control mechanism
which is not supported in eCos.
If you need to to stop and start threads you should really be doing it
using explicit synchronization mechanisms. Stopping and starting
threads without their cooperation is usually a bad idea, since you
don't know what state they are in and it can lead to deadlock.
>
> 2) I am using insight to debug my applications. I can debug anything
in
> the main thread. But as soon as I put a break point in a thread that I
> create from main, insight hangs. Any ideas on how to do this?
I cannot really help here except to suggest trying it from a
commandline-only GDB, which may give you more information about what
is happening.
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com The eCos and RedBoot experts
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss