mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Merge remote-tracking branch 'origin/topic/bernhard/alternative-deadlock-fix'
* origin/topic/bernhard/alternative-deadlock-fix: alternative deadlock issue fix.
This commit is contained in:
commit
15e72d1422
2 changed files with 17 additions and 5 deletions
|
@ -63,11 +63,13 @@ public:
|
|||
/**
|
||||
* Returns true if the next Get() operation might succeed. This
|
||||
* function may occasionally return a value not indicating the actual
|
||||
* state, but won't do so very often. Occasionally we also return a
|
||||
* true unconditionally to avoid a deadlock when both pointers happen
|
||||
* to be equal even though there's stuff queued.
|
||||
* state, but won't do so very often. Note that this means that it can
|
||||
* consistently return false even if there is something in the Queue.
|
||||
* You have to check real queue status from time to time to be sure that
|
||||
* it is empty. In other words, this method helps to avoid locking the queue
|
||||
* frequently, but doesn't allow you to forgo it completely.
|
||||
*/
|
||||
bool MaybeReady() { return (read_ptr != write_ptr) || (random() % 10000 == 0); }
|
||||
bool MaybeReady() { return (read_ptr != write_ptr); }
|
||||
|
||||
/** Wake up the reader if it's currently blocked for input. This is
|
||||
primarily to give it a chance to check termination quickly.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue