[gccsdk] Threads & Wimp_StartTask
John.Tytgat at aaug.net
Wed Feb 27 13:39:29 PST 2008
In message <24dad9774f.admin at snowstone.org.uk>
Adam <lists at snowstone.org.uk> wrote:
> 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.
John Tytgat, in his comfy chair at home BASS
John.Tytgat at aaug.net ARM powered, RISC OS driven
More information about the gcc