| 1 |
~~~~~~~ |
| 2 |
Polling |
| 3 |
~~~~~~~ |
| 4 |
|
| 5 |
.. include:: prologue.rst |
| 6 |
|
| 7 |
As of release 5.0, BRLTTY has been converted from being polling-based to being |
| 8 |
event-based. This means, among other things, that it's now able to become |
| 9 |
completely idle whenever it doesn't have anything useful to do. For comparison, |
| 10 |
it formerly used a huge, central, main loop which was run frequently (about 25 |
| 11 |
times per second), and which was aware of, and had to check for, every single |
| 12 |
task that might need to be performed. |
| 13 |
|
| 14 |
In practical terms, this change, when compared with how BRLTTY used to work, |
| 15 |
delivers at least the following significant benefits: |
| 16 |
|
| 17 |
* Noticeably improved response time. Near instant reaction to significant user |
| 18 |
and system events rather than waiting for the next polling cycle to check |
| 19 |
for them. |
| 20 |
|
| 21 |
* Much less system load. Just a few, short-lived bursts of activity when |
| 22 |
actually necessary rather than frequent, much longer-lived checking that, |
| 23 |
far more often than not, resulted in nothing needing to be done. |
| 24 |
|
| 25 |
* Way less battery drain. The system is no longer forced either to remain |
| 26 |
awake or to continually wake up after a rather brief nap. |
| 27 |
|
| 28 |
There are cases in which polling is still being used. Some of these will |
| 29 |
eventually be resolved by future code changes, while others, unfortunately, are |
| 30 |
required due to host platform limitations. |
| 31 |
|
| 32 |
.. topic:: Monitoring for Screen Updates |
| 33 |
|
| 34 |
This task involves checking for size changes, content changes, highlighting |
| 35 |
changes, cursor movement, etc. It's event-based on: |
| 36 |
|
| 37 |
* Android |
| 38 |
|
| 39 |
* Linux text consoles if the kernel is at least 2.6.37 (released on January 4, |
| 40 |
2011) |
| 41 |
|
| 42 |
* Linux graphics consoles monitored via AT-SPI2. |
| 43 |
|
| 44 |
On other platforms, |frequent polling| is used. |
| 45 |
|
| 46 |
.. topic:: Monitoring for Serial Input |
| 47 |
|
| 48 |
This task is event-based on: |
| 49 |
|
| 50 |
* Linux |
| 51 |
|
| 52 |
On other platforms, |frequent polling| is used. |
| 53 |
|
| 54 |
.. topic:: Monitoring for USB Input |
| 55 |
|
| 56 |
This task is event-based on: |
| 57 |
|
| 58 |
* Linux |
| 59 |
|
| 60 |
On other platforms, |frequent polling| is used. |
| 61 |
|
| 62 |
.. topic:: Monitoring for Bluetooth Input |
| 63 |
|
| 64 |
This task is event-based on: |
| 65 |
|
| 66 |
* Android |
| 67 |
|
| 68 |
* Linux |
| 69 |
|
| 70 |
On other platforms, |frequent polling| is used. |
| 71 |
|
| 72 |
.. topic:: Starting the Braille Driver |
| 73 |
|
| 74 |
On all platforms, |periodic retrying| is used. |
| 75 |
|
| 76 |
.. topic:: Starting the Speech Driver |
| 77 |
|
| 78 |
On all platforms, |periodic retrying| is used. |
| 79 |
|
| 80 |
.. topic:: Starting the Screen Driver |
| 81 |
|
| 82 |
On all platforms, |periodic retrying| is used. |
| 83 |
|
| 84 |
.. topic:: Starting the Keyboard Monitor |
| 85 |
|
| 86 |
On all platforms, |periodic retrying| is used. |
| 87 |
|
| 88 |
.. topic:: Creating the PID File |
| 89 |
|
| 90 |
On all platforms, |periodic retrying| is used. |
| 91 |
|
| 92 |
.. |frequent polling| replace:: frequent polling (about every 40 milliseconds) |
| 93 |
.. |periodic retrying| replace:: periodic retrying (about every five seconds) |