| 5537 | |
| 5538 | extern int busywait; |
| 5539 | static void scanlinesleep(int currline, int nextline) |
| 5540 | { |
| 5541 | if (currline < 0) |
| 5542 | return; |
| 5543 | if (currline >= nextline) |
| 5544 | return; |
| 5545 | if (vsync_hblank) { |
| 5546 | int diff = (int)(vsync_hblank / (nextline - currline)); |
| 5547 | int us = 1000000 / diff; |
| 5548 | if (us < target_sleep_nanos(-1)) { // spin if less than minimum sleep time |
| 5549 | target_spin(nextline - currline - 1); |
| 5550 | return; |
| 5551 | } |
| 5552 | } |
| 5553 | if (busywait) { |
| 5554 | target_spin(1); |
| 5555 | return; |
| 5556 | } |
| 5557 | if (currprefs.m68k_speed < 0) |
| 5558 | sleep_millis_main(1); |
| 5559 | else |
| 5560 | target_sleep_nanos(500); |
| 5561 | } |
| 5562 | |
| 5563 | static void linesync_first_last_line(int *first, int *last) |
| 5564 | { |
no test coverage detected