Items Maxima sent, on their way from the socket thread to the GUI thread.
More...
#include <MaximaItemQueue.h>
|
| | MaximaItemQueue (int mergeableCause, std::size_t backPressureChars=DefaultBackPressureChars) |
| |
| bool | Push (std::vector< Item > &&items) |
| | Appends items.
|
| |
| bool | Take (Item &item) |
| | Takes the oldest item, merged with the mergeable items that follow it.
|
| |
|
bool | Empty () const |
| | Whether nothing is waiting.
|
| |
|
std::size_t | QueuedChars () const |
| | The number of characters waiting.
|
| |
|
bool | BackPressure () const |
| | Whether the socket thread should stop reading until the GUI caught up.
|
| |
|
void | Clear () |
| | Drops everything that waits.
|
| |
Items Maxima sent, on their way from the socket thread to the GUI thread.
Push() is called from the socket thread, everything else from the GUI thread; BackPressure() is safe from either.
◆ MaximaItemQueue()
- Parameters
-
| mergeableCause | Consecutive items of this kind are handed out as one (plain text that only got split because it arrived in pieces). |
| backPressureChars | How many characters may wait before the socket thread should stop reading. |
◆ Push()
| bool MaximaItemQueue::Push |
( |
std::vector< Item > && |
items | ) |
|
Appends items.
Called by the socket thread.
- Returns
- true if the consumer has to be told that there is something to take: that is the case only if it found the queue empty last time it looked, and hasn't been told since.
◆ Take()
| bool MaximaItemQueue::Take |
( |
Item & |
item | ) |
|
Takes the oldest item, merged with the mergeable items that follow it.
- Returns
- false if there was nothing to take. From then on the next Push() asks for a notification again.
◆ DefaultBackPressureChars
| constexpr std::size_t MaximaItemQueue::DefaultBackPressureChars = 64 * 1024 |
|
staticconstexpr |
The default for how much output may wait.
Enough for a GUI turn's worth of output even of the fastest flood seen (disp() in a loop, about 40 characters a line), and little enough that what is left to display after the user pressed Ctrl+G takes seconds, not minutes. A single item larger than this (a huge matrix) still gets through: the limit only stops the socket thread from reading more.
The documentation for this class was generated from the following files: