Mercurial > hg > early-roguelike
comparison rogue3/mdport.c @ 212:12e070d1a780
rogue3: replace alarm() calls with a portable function.
Calls to alarm() in main.c are replaced with md_start_checkout_timer(),
so the #ifdefs around nonportable code can be confined to mdport.c.
| author | John "Elwin" Edwards |
|---|---|
| date | Fri, 22 Jan 2016 19:19:48 -0500 |
| parents | 600873555ec0 |
| children | 3d4252fa2ed3 |
comparison
equal
deleted
inserted
replaced
| 211:382ff498acdd | 212:12e070d1a780 |
|---|---|
| 1508 #ifdef SIGTSTP | 1508 #ifdef SIGTSTP |
| 1509 kill(0, SIGTSTP); /* send actual signal and suspend process */ | 1509 kill(0, SIGTSTP); /* send actual signal and suspend process */ |
| 1510 #endif | 1510 #endif |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 #if defined(CHECKTIME) | |
| 1514 void | 1513 void |
| 1515 md_start_checkout_timer(int time) | 1514 md_start_checkout_timer(int time) |
| 1516 { | 1515 { |
| 1517 int checkout(); | 1516 void checkout(); |
| 1518 | 1517 |
| 1519 #if defined(HAVE_ALARM) && defined(SIGALRM) | 1518 #if defined(HAVE_ALARM) && defined(SIGALRM) |
| 1520 signal(SIGALRM, checkout); | 1519 signal(SIGALRM, checkout); |
| 1521 alarm(time); | 1520 alarm(time); |
| 1522 #endif | 1521 #endif |
| 1527 { | 1526 { |
| 1528 #if defined(SIGALRM) | 1527 #if defined(SIGALRM) |
| 1529 signal(SIGALRM, SIG_IGN); | 1528 signal(SIGALRM, SIG_IGN); |
| 1530 #endif | 1529 #endif |
| 1531 } | 1530 } |
| 1532 #endif | |
| 1533 | 1531 |
| 1534 long | 1532 long |
| 1535 md_memused() | 1533 md_memused() |
| 1536 { | 1534 { |
| 1537 #ifdef _WIN32 | 1535 #ifdef _WIN32 |
