Skip to contentSkip to conversation

missing wait_event_timeout

DISCUSSION Steve French 1 participant 2 messages Aug 24, 2004

lore
Share & tools
lore
#0 lore raw

Is there a reason why there is no wait_event_timeout function in kernel. There is only the __wait_event_timeout_interruptible in wait.h It seems the easiest way to fix the few remaining pieces of code which call the deprecated sleep_on_timeout.

ie something like:

Quoted 14 lines

#define __wait_event_timeout(wq, condition, ret)

do {			
	DEFINE_WAIT(__wait);	
				
	for (;;) {		
		prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE);
		if (condition)				
			break;				
		ret = schedule_timeout(ret);	
		if (!ret)			
			break;			
	}						
	finish_wait(&wq, &__wait);					
} while (0)
#1 lore raw

Maybe it is just safer to call wait_event with the timeout check as one of the conditions?

Quoted 24 lines · Steve French

Is there a reason why there is no wait_event_timeout function in kernel. There is only the __wait_event_timeout_interruptible in wait.h It seems the easiest way to fix the few remaining pieces of code which call the deprecated sleep_on_timeout.

ie something like:

Quoted 14 lines

#define __wait_event_timeout(wq, condition, ret)

do {			
	DEFINE_WAIT(__wait);	
				
	for (;;) {		
		prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE);
		if (condition)				
			break;				
		ret = schedule_timeout(ret);	
		if (!ret)			
			break;			
	}						
	finish_wait(&wq, &__wait);					
} while (0)