| 277 | } |
| 278 | |
| 279 | static bool getsem (int unitnum, bool dowait) |
| 280 | { |
| 281 | struct blkdevstate *st = &state[unitnum]; |
| 282 | if (st->sema == NULL) |
| 283 | uae_sem_init (&st->sema, 0, 1); |
| 284 | bool gotit = false; |
| 285 | if (dowait) { |
| 286 | uae_sem_wait (&st->sema); |
| 287 | gotit = true; |
| 288 | } else { |
| 289 | gotit = uae_sem_trywait (&st->sema) == 0; |
| 290 | } |
| 291 | if (gotit) |
| 292 | st->sema_cnt++; |
| 293 | if (st->sema_cnt > 1) |
| 294 | write_log (_T("CD: unitsem%d acquire mismatch! cnt=%d\n"), unitnum, st->sema_cnt); |
| 295 | return gotit; |
| 296 | } |
| 297 | static bool getsem (int unitnum) |
| 298 | { |
| 299 | return getsem (unitnum, false); |
no test coverage detected