mirror of
https://github.com/wqking/eventpp.git
synced 2024-12-27 16:41:11 +08:00
Updated documents
This commit is contained in:
parent
115dae57db
commit
7dbcf72cb1
@ -129,7 +129,7 @@ template <typename Predictor>
|
|||||||
bool processIf(Predictor && 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.
|
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` returns true if any event was dispatched, false if no event was dispatched.
|
||||||
`processIf` has some good use scenarios:
|
`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.
|
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.
|
||||||
|
@ -13,9 +13,12 @@
|
|||||||
<a id="a2_1"></a>
|
<a id="a2_1"></a>
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
OrderedQueueList is a utility class that sorts the events in an EventQueue in certain order.
|
`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.
|
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.
|
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>
|
<a id="a2_2"></a>
|
||||||
## API reference
|
## API reference
|
||||||
|
Loading…
x
Reference in New Issue
Block a user