eliminate a race condition on taking/processing samples in throughput subscriber
In listener mode, the main thread would still periodically try to take samples. When this happens concurrently with the listener invocation, the result is a spurious warning that some samples were delivered out-of-order. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
		
							parent
							
								
									84a25ab92d
								
							
						
					
					
						commit
						0f7145fe7c
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -250,15 +250,15 @@ static void process_samples(dds_entity_t reader, unsigned long long maxCycles)
 | 
			
		|||
  while (!done && (maxCycles == 0 || cycles < maxCycles))
 | 
			
		||||
  {
 | 
			
		||||
    if (pollingDelay > 0)
 | 
			
		||||
    {
 | 
			
		||||
      dds_sleepfor (DDS_MSECS (pollingDelay));
 | 
			
		||||
      while (do_take (reader))
 | 
			
		||||
        ;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      status = dds_waitset_wait (waitSet, wsresults, sizeof(wsresults)/sizeof(wsresults[0]), DDS_SECS(1));
 | 
			
		||||
      status = dds_waitset_wait (waitSet, wsresults, sizeof(wsresults)/sizeof(wsresults[0]), DDS_MSECS(100));
 | 
			
		||||
      DDS_ERR_CHECK (status, DDS_CHECK_REPORT | DDS_CHECK_EXIT);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (pollingDelay >= 0)
 | 
			
		||||
    {
 | 
			
		||||
      while (do_take (reader))
 | 
			
		||||
        ;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue