Re: [AD] yield_timeslice

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Chris:
> Daniel Schlyder wrote:

>>Chris:
>>  
>>
>>>#define yield_timeslice()  rest(0)
>>>    
>>>
>>That won't work unless rest() is changed; it calls yield_timeslice() on some
>>platforms.
>>  
>>

> That would work fine since rest's behavior depends on the system driver. 

Only as long as the system driver's rest function pointer isn't NULL, which it
happens to be for both the SIGALRM and pthreads timer modules for UNIX. The
following code is used if that is the case:

     rest_count = time;

     if (install_int(rest_int, 1) < 0)
        return;

     do {
        if (callback)
           callback();
        else
           yield_timeslice();

     } while (rest_count > 0);

     remove_int(rest_int);

     
Kind regards,
Daniel Schlyder
--
http://bitblaze.com/





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/