[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: blocking pre-emting



you can not get the correct time in the first place.

t
=
gettime();

The assignment itself can be preempted for long time.
The only guarantteed solution is to use atomic instruction to
update kernel time variable if such thing exists.

Hong

> -----Original Message-----
> From: phil-list-admin redhat com 
> [mailto:phil-list-admin redhat com] On Behalf Of Senthil Nathan V
> Sent: Wednesday, December 17, 2003 22:04
> To: phil-list redhat com
> Subject: blocking pre-emting
> 
> 
>   Hell Everyone!!
> 
>    I have this situation. I need to take the current time of 
> the system, and
> update with the new value and set the time. I'm doing some 
> thing like this
> 
> 1. t = gettime() ;
> 2. t = t + deviation ;
> 3. settime( t )  ;
> 
>  I assume that time taken to execute these statements is negligible. 
> 
> My doubt is if there is no switch over at the time of 
> execution of these 
> statements the time would be set almost right but, if any switch over 
> occurs before statement  3 and after statement  1. I might miss some 
> seconds in the actual time. 
> 
> 
> 1. How do I over come this? 
> 2. Is there any way I to block pre-emtion at the time of 
> execution of these 
> sequence of statements in user program?
> 
>  Thanks in advance..
> 
>  --regards,
>    Senthil Nathan V
>    Odyssey Technologies Limited
>   
>   
> 
> 
> -- 
> Phil-list mailing list
> Phil-list redhat com
> https://www.redhat.com/mailman/listinfo/phil-list
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]