Add Receiver->HasPending()

This commit is contained in:
ArthurSonzogni 2020-05-25 02:36:32 +02:00 committed by Arthur Sonzogni
parent 823e0906da
commit 883b34503d

View File

@ -21,8 +21,8 @@ namespace ftxui {
// --------------- // ---------------
// //
// auto receiver = MakeReceiver<std:string>(); // auto receiver = MakeReceiver<std:string>();
// auto sender_1= receiver.MakeSender(); // auto sender_1= receiver->MakeSender();
// auto sender_2 = receiver.MakeSender(); // auto sender_2 = receiver->MakeSender();
// //
// Then move the senders elsewhere, potentially in a different thread. // Then move the senders elsewhere, potentially in a different thread.
// //
@ -83,6 +83,11 @@ class ReceiverImpl {
return false; return false;
} }
bool HasPending() {
std::unique_lock<std::mutex> lock(mutex_);
return !queue_.empty();
}
private: private:
friend class SenderImpl<T>; friend class SenderImpl<T>;