| 666 | } |
| 667 | |
| 668 | std::string toString() const { |
| 669 | if (mode == WRITE) { |
| 670 | return format("{WriteCursor %s:%p pos=%s:%d rawEndOffset=%d}", |
| 671 | queue->name.c_str(), |
| 672 | this, |
| 673 | ::toString(pageID).c_str(), |
| 674 | offset, |
| 675 | page ? header()->endOffset : -1); |
| 676 | } |
| 677 | if (mode == POP || mode == READONLY) { |
| 678 | return format("{ReadCursor %s:%p pos=%s:%d rawEndOffset=%d endPage=%s nextPage=%s}", |
| 679 | queue->name.c_str(), |
| 680 | this, |
| 681 | ::toString(pageID).c_str(), |
| 682 | offset, |
| 683 | (page && header()) ? header()->endOffset : -1, |
| 684 | ::toString(endPageID).c_str(), |
| 685 | ::toString(nextPageID).c_str()); |
| 686 | } |
| 687 | ASSERT(mode == NONE); |
| 688 | return format("{NullCursor=%p}", this); |
| 689 | } |
| 690 | |
| 691 | // Returns true if the mutex cannot be immediately taken. |
| 692 | bool isBusy() { return !mutex.available(); } |
no test coverage detected