Return an estimate of the current queue length.
| 107 | |
| 108 | // Return an estimate of the current queue length. |
| 109 | int estimated_queue_length() const { |
| 110 | ANNOTATE_IGNORE_READS_BEGIN(); |
| 111 | // The C++ standard says that std::multiset::size must be constant time, |
| 112 | // so this method won't try to traverse any actual nodes of the underlying |
| 113 | // RB tree. Investigation of the libstdcxx implementation confirms that |
| 114 | // size() is a simple field access of the _Rb_tree structure. |
| 115 | int ret = queue_.size(); |
| 116 | ANNOTATE_IGNORE_READS_END(); |
| 117 | return ret; |
| 118 | } |
| 119 | |
| 120 | // Return an estimate of the number of idle threads currently awaiting work. |
| 121 | int estimated_idle_worker_count() const { |