[gccsdk] Threads & Wimp_StartTask

Adam lists at snowstone.org.uk
Wed Feb 27 15:58:29 PST 2008


In message <e302e2774f.Jo at hobbes.bass-software.com>, John Tytgat wrote:

> In message <24dad9774f.admin at snowstone.org.uk>
>           Adam <lists at snowstone.org.uk> wrote:
> 
> > Hi,
> > 
> > On comp.sys.acorn.programmer, John wrote:
> > > I haven't followed the rest of this thread but if you think there is
> > > still a problem with UnixLib's thread implementation, feel free to
> > > discuss this in the gccsdk mailing list.
> > 
> > Well, I think it's more likely that I'm doing something wrong. However,
> > I'm having a problem trying to use Wimp_StartTask in a wimp task which
> > has two threads.
> > 
> > If I call Wimp_StartTask before the second thread (e.g. the first one
> > explicitly created by me) is pthread_created then eveything is OK, but
> > if I call the SWI after that point the "child" task crashes - with
> > symptoms ranging from a complete freeze of the machine to data aborts.
> > 
> > I can put together some example code if it helps.
> 
> Ah, Wimp_StartTask. I'm not surprised that this doesn't work.  The
> threading itself needs to be stopped when you're creating a new task as
> there are certainly moments where it doesn't like to see it switched.
> So call __pthread_stop_ticker() before your Wimp_StartTask SWI and
> __pthread_start_ticker() afterwards to reenable the threads.  I expect
> that makes the crashes go away.

Yes, thanks, that did the trick :)

Adam

-- 
Adam Richardson          Carpe Diem
http://www.snowstone.org.uk/riscos/




More information about the gcc mailing list