Skip to content

The enqueue function returns the number of items in the work queue#1

Open
umar456 wants to merge 1 commit into
masterfrom
return_count
Open

The enqueue function returns the number of items in the work queue#1
umar456 wants to merge 1 commit into
masterfrom
return_count

Conversation

@umar456

@umar456 umar456 commented Apr 13, 2018

Copy link
Copy Markdown
Member

No description provided.

@umar456
umar456 requested a review from pavanky April 13, 2018 02:43
Comment thread async_queue.hpp
cond.notify_one();
}
return;
return count;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a bit misleading ? If you enqueue from the queue you are going to get 0. Why not always return work_queue.size() ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to take the lock to get the count. It also make sense because the operations are performed immediately and they are not inserted into the queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants