ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/C64_x.h
(Generate patch)

Comparing Frodo4/Src/C64_x.h (file contents):
Revision 1.5 by cebix, 2004-01-10T15:07:14Z vs.
Revision 1.8 by cebix, 2005-06-27T19:55:48Z

# Line 1 | Line 1
1   /*
2   *  C64_x.h - Put the pieces together, X specific stuff
3   *
4 < *  Frodo (C) 1994-1997,2002-2003 Christian Bauer
4 > *  Frodo (C) 1994-1997,2002-2005 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 95 | Line 95 | int usleep(unsigned long int microSecond
95   }
96   #endif
97  
98 + #ifdef __linux__
99 + // select() timing is much more accurate under Linux
100 + static void Delay_usec(unsigned long usec)
101 + {
102 +        int was_error;
103 +        struct timeval tv;
104 +
105 +        tv.tv_sec = 0;
106 +        tv.tv_usec = usec;
107 +        do {
108 +                errno = 0;
109 +                was_error = select(0, NULL, NULL, NULL, &tv);
110 +        } while (was_error && (errno == EINTR));
111 + }
112 + #else
113 + static void Delay_usec(unsigned long usec)
114 + {
115 +        usleep(usec);
116 + }
117 + #endif
118 +
119  
120   /*
121   *  Constructor, system-dependent things
# Line 247 | Line 268 | void C64::VBlank(bool draw_frame)
268  
269                  // Limit speed to 100% if desired
270                  if ((speed_index > 100) && ThePrefs.LimitSpeed) {
271 <                        usleep((unsigned long)(ThePrefs.SkipFrames * 20000 - elapsed_time));
271 >                        Delay_usec((unsigned long)(ThePrefs.SkipFrames * 20000 - elapsed_time));
272                          speed_index = 100;
273                  }
274  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines