| 458 | **/ |
| 459 | #if (HXCPP_API_LEVEL > 420) |
| 460 | Dynamic _hx_std_process_exit( Dynamic handle, bool block ) |
| 461 | { |
| 462 | vprocess *p = getProcess(handle); |
| 463 | |
| 464 | hx::EnterGCFreeZone(); |
| 465 | #ifdef NEKO_WINDOWS |
| 466 | { |
| 467 | DWORD rval; |
| 468 | DWORD wait = INFINITE; |
| 469 | if (!block) |
| 470 | wait = 0; |
| 471 | |
| 472 | WaitForSingleObject(p->pinf.hProcess,wait); |
| 473 | hx::ExitGCFreeZone(); |
| 474 | |
| 475 | if( !GetExitCodeProcess(p->pinf.hProcess,&rval) && block) |
| 476 | return 0; |
| 477 | else if (!block && rval == STILL_ACTIVE) |
| 478 | return null(); |
| 479 | else |
| 480 | return rval; |
| 481 | } |
| 482 | #else |
| 483 | int options=0; |
| 484 | if (!block) |
| 485 | options = WNOHANG; |
| 486 | |
| 487 | int rval=0; |
| 488 | pid_t ret=-1; |
| 489 | while( (ret = waitpid(p->pid,&rval,options)) != p->pid ) |
| 490 | { |
| 491 | if( errno == EINTR ) |
| 492 | continue; |
| 493 | |
| 494 | if (!block && ret == 0) |
| 495 | { |
| 496 | hx::ExitGCFreeZone(); |
| 497 | return null(); |
| 498 | } |
| 499 | |
| 500 | hx::ExitGCFreeZone(); |
| 501 | return 0; |
| 502 | } |
| 503 | hx::ExitGCFreeZone(); |
| 504 | if( !WIFEXITED(rval) ) |
| 505 | return 0; |
| 506 | |
| 507 | return WEXITSTATUS(rval); |
| 508 | #endif |
| 509 | } |
| 510 | #else |
| 511 | int _hx_std_process_exit( Dynamic handle ) |
| 512 | { |
nothing calls this directly
no test coverage detected