1
0
mirror of https://github.com/wqking/eventpp.git synced 2024-12-27 00:17:02 +08:00

Updated documents

This commit is contained in:
wqking 2021-10-28 21:11:57 +08:00
parent 115dae57db
commit 7dbcf72cb1
2 changed files with 7 additions and 4 deletions

View File

@ -129,7 +129,7 @@ template <typename Predictor>
bool processIf(Predictor && predictor);
```
Process the event queue. Before processing an event, the event is passed to `predictor` and the event will be processed only if `predictor` returns true.
`predictor` is a callable object that takes exactly the same arguments as `EventQueue::enqueue` or have no arguments, and returns a boolean value. eventpp will pass the arguments properly.
`predictor` is a callable object(function, lambda, etc) that takes exactly the same arguments as `EventQueue::enqueue` or have no arguments, and returns a boolean value. eventpp will pass the arguments properly.
`processIf` returns true if any event was dispatched, false if no event was dispatched.
`processIf` has some good use scenarios:
1. Process certain events in certain thread. For example, in a GUI application, the UI related events may be only desired to be processed in the main thread.

View File

@ -13,9 +13,12 @@
<a id="a2_1"></a>
## Description
OrderedQueueList is a utility class that sorts the events in an EventQueue in certain order.
With OrderedQueueList, we can dispatch events in certain order such as in priority order.
This class is used by the QueueList policy. See [document of policies](policies.md) for details.
`OrderedQueueList` is a utility class that sorts the events in an EventQueue in certain order.
With `OrderedQueueList`, we can dispatch events in certain order such as in priority order.
This class is used with the `QueueList` policy. See [document of policies](policies.md) for details and how to implement new `QueueList`.
Warning: `OrderedQueueList` is not efficient since it simply inherits from `std::list` and sorts the full list on each `splice`.
To use it in performance critical applications, you should implement your own version with sophisticated algorithm.
<a id="a2_2"></a>
## API reference