Multithreading
Theo Markettos (89) 919 posts |
The Synopsys DWC USB driver (for the Raspberry Pi) says this in its documentation
Any ideas how this kind of lightweight threading might be done on RISC OS? I think it might be possible to come up with something based on callbacks, but I’m not familiar with the intricacies. UnixLib has a pthread library (based on, I think, calling Wimp_Poll inside a transient callback) which I assume wouldn’t be suitable. |
Jeffrey Lee (213) 6048 posts |
UnixLib’s library uses a callback triggered from a ticker event to manage thread preemption. Calling Wimp_Poll isn’t necessary, since all the threads run within the same Wimp task. I suspect that using a simple scheme like that won’t be suitable for the USB drivers. Firstly it could be a long time until callbacks get triggered, and secondly even if callbacks are triggering on time, one centisecond is a very long time when you’re dealing with a 480Mbps bus. One of the reasons SCSISoftUSB was so slow was that it was using a ticker event to schedule USB reads/writes. I think RTSupport is the closest thing to what you need. Some care will be needed when interfacing with the USB stack (I can’t remember the exact rules, but I’m fairly certain that some calls are only safe to make from the foreground – i.e. via a callback), but all the internal threads and task queues that the Synopsys driver uses should be able to run off of RTSupport threads/tasks. |
Benoit Gilon (259) 14 posts |
May I suggest that you take a look at the experiments I did some years ago, and which results archive URL currently is: http://habett.org/armada/logiciels/mthrea.zip ? HTHATS, |
Benoit Gilon (259) 14 posts |
I copied the archive to my personal Web site so now you can find it via: http://bgilon.free.fr/RISCOS/preview/mthrea.zip too. |
Sekhar (2205) 1 post |
Hii, |
Trevor Johnson (329) 1645 posts |
Hi. To avoid potential confusion, would you please be so kind as to consider confirming that you are programming under RISC OS? Thanks. |