Skip to content

Commit

Permalink
Merge pull request cameron314#25 from Kampbell/master
Browse files Browse the repository at this point in the history
Fix the example
  • Loading branch information
cameron314 committed Jan 13, 2016
2 parents 65980a8 + c6b5b03 commit 03b01e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ succeeded = q.try_dequeue(number); // Returns false if the queue was empty
assert(succeeded && number == 17);

// You can also peek at the front item of the queue (consumer only)
int* front = q.peek(); // Returns nullptr if the queue was empty
assert(front == nullptr);
int* front = q.peek();
assert(*front == 18);
succeeded = q.try_dequeue(number);
assert(succeeded && number == 18);
front = q.peek();
assert(front == nullptr); // Returns nullptr if the queue was empty
```
The blocking version has the exact same API, with the addition of a `wait_dequeue` method:
Expand Down

0 comments on commit 03b01e8

Please sign in to comment.