On Wed, Aug 29, 2012 at 01:56:05PM -0400, Hans-Peter Nilsson wrote:
> On Wed, 29 Aug 2012, Segher Boessenkool wrote:
> > On some systems the timebase runs at a rather low frequency, say 20MHz.
> > This test will spuriously fail there.  Waste a million CPU cycles before
> > reading TB the second time?
> 
> Waste said million cycles portably by calling sched_yield()?
> (Available only on POSIX systems. :)

Well only for a test environment.  You don't want to call sched_yield in the
normal case, since the apps that do this many millions of times need this to be
as a fast as possible.

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meiss...@linux.vnet.ibm.com     fax +1 (978) 399-6899

Reply via email to