Hello Peter, On 01.03.21 13:42, Peter Korsgaard wrote: >>>>>> "Ahmad" == Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> writes: > > Hi, > > > +bthreads > > +-------- > > + > > +barebox threads are co-operative green threads, which are scheduled whenever > > +``is_timeout()`` is called. This has a few implications. First of all, > > +bthreads are not scheduled when ``is_timeout()`` is not called. > > +For this and other reasons, loops polling for hardware events should always > > +use a timeout, which is best implemented with ``is_timeout()``. > > +Another thing to remember is that bthreads can be scheduled anywhere > > +in the middle of other device accesses whenever ``is_timeout()`` is > > +called. Care must be taken that a green thread doesn't access the very same device > > +again itself. See "slices" below on how devices can safely be accessed from > > +bthreads. > > + > > +Unlike pollers, which bthreads are replacing, bthreads are allowed > > +access to virtual filesystem. The macro ``assert_command_context()`` is added > > +to entry points of the VFS to have the thread yield until it may execute in > > +in the correct context. The poller interface is declared in > > s/poller/bthread/ > > > +``include/bthread.h``. ``bthread_create()`` is used to allocate a bthread > > +control block along with its stack. ``bthread_wake()`` can be used to hang > > +it into the run queue. From this moment on and until the thread terminates, > > s/hang it into/add/ > > > +the thread will be switched to regularly as long as someone calls > > +``is_timeout()``. bthreads are allowed to call ``is_timeout()``, which will > > +arrange for other threads to execute. > > + > > +barebox threads replace previous the previous pollers and workqueues. Poller > > s/previous the previous/the previous infrastructure,/ Thanks! Just sent out a fixup. > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox