mirror of
				https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
				synced 2025-11-03 12:07:57 +00:00 
			
		
		
		
	Add yield (#64)
Simply calls rd_kafka_yield; allows consumers and producers to abort the current callback dispatcher.
This commit is contained in:
		
				
					committed by
					
						
						Matias Fontanini
					
				
			
			
				
	
			
			
			
						parent
						
							d9feb5c3db
						
					
				
				
					commit
					ee71b3979a
				
			@@ -200,6 +200,13 @@ public:
 | 
				
			|||||||
     * This calls rd_kafka_outq_len
 | 
					     * This calls rd_kafka_outq_len
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int get_out_queue_length() const;
 | 
					    int get_out_queue_length() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * \brief Cancels the current callback dispatcher
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * This calls rd_kafka_yield
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void yield() const;
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    KafkaHandleBase(Configuration config);
 | 
					    KafkaHandleBase(Configuration config);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -165,6 +165,10 @@ int KafkaHandleBase::get_out_queue_length() const {
 | 
				
			|||||||
    return rd_kafka_outq_len(handle_.get());
 | 
					    return rd_kafka_outq_len(handle_.get());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void KafkaHandleBase::yield() const {
 | 
				
			||||||
 | 
					    rd_kafka_yield(handle_.get());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KafkaHandleBase::set_handle(rd_kafka_t* handle) {
 | 
					void KafkaHandleBase::set_handle(rd_kafka_t* handle) {
 | 
				
			||||||
    handle_ = HandlePtr(handle, &rd_kafka_destroy);
 | 
					    handle_ = HandlePtr(handle, &rd_kafka_destroy);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user