[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] OpenGL repaint loop



Mads Bondo Dydensborg wrote:

Vil det ikke sætte processoren i 100% arbejde ?



Jow, og det er også sådan spil gør. Hvis du ikke vil det, kan du jo lave:


while ( running ) {
    if ( World->update() ) { // update returnerer true, hvis noget ændret
        World->draw(); // Tilbage til update umiddelbart efter draw.
    } else {
         sleep( 20 ms );
    }
}



Fint nok. Det lyder lidt bedre, men min World::update funktion bliver kaldt 1000000 gange hvor intet ændres. Er det tungt at sætte tråden til at sove, og først vække den, når Update vil returnere 'true' ?
Altså noget pthread_cond_{wait,signal} ?


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-09-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *