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: Gary Thomas <gary at mlbassoc dot com>
- To: "Ali, Khurram" <Khurram_Ali at mentorg dot com>
- Cc: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Fri, 08 Apr 2005 10:25:35 -0600
- Subject: RE: [ECOS] Task suspension and resumption in POSIX
- Organization: MLB Associates
- References: <32A0F6EE19ECF646A9CF370C3AB15EBE01109DEA@SVR-ALH-EXC-02.mgc.mentorg.com>
On Fri, 2005-04-08 at 11:18 -0500, Ali, Khurram wrote:
> Thank you for the quick reply.
>
> I actually just want to do a self-suspend. And another task resumes the
> suspended task.
Why not use the synchronization primitives, e.g. semaphores, that
were designed for just this sort of operation?
>
> 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
>
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss