This is the mail archive of the
mailing list for the eCos project.
Re: Threads that end
- To: ecos-discuss at sourceware dot cygnus dot com
- Subject: Re: [ECOS] Threads that end
- From: jens dot ohlund at secrc dot abb dot se
- Date: Fri, 30 Jun 2000 08:45:16 +0200
Thanks for the confirmation. Now, how do I detect from another thread that one thread is "finished" so i can delete it ?
I don't have any locks in those two threads, so hanging on a resurce doesn't happen. I just want my memory back :).
But, just an idea, your giving a stack to the thread to run in. If the thread allocates any local variables, the are on the threads
Then I would be able to just kill the thread and then create a new thread, with the old "stack" as parameter to the cy_thread_create
cc: firstname.lastname@example.org, Robert Erskine <email@example.com>
Subject: Re: [ECOS] Threads that end
Security Level:? Internal
> Hi !
> I wonder what happens when a thread leaves the method it was given to run when created.
> Does it just "run away" or does it "die" (suspend) or what ?
> Does the thread leaves the method, frees up resources and turns to a suspend mode ?
It doesn't free up resources, but it does suspend.
> If it does, does that mean I have to delete it afterwards to make it disaper in the scheduler ?
Indeed so, use cyg_thread_delete() for that. See
[ although Robert take note: the HTML fonts in this bit are all wrong ]
In summary, cyg_thread_kill() sends a kill message to a thread, causing it
to wake up and return an error message from whatever it's locked in the
kernel doing. cyg_thread_delete() deregisters the thread from the
scheduler, freeing up the thread resources (although not any resources
allocated by the thread itself, if you see what I mean).
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow." || These opinions are all my own fault