MCPcopy Create free account
hub / github.com/THUNLP-MT/MEAN / wait

Method wait

evaluation/TMscore.cpp:1757–1787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1755 */
1756 template <typename C, typename T>
1757 int
1758 basic_pstreambuf<C,T>::wait(bool nohang)
1759 {
1760 int child_exited = -1;
1761 if (is_open())
1762 {
1763 int exit_status;
1764 switch(::waitpid(ppid_, &exit_status, nohang ? WNOHANG : 0))
1765 {
1766 case 0 :
1767 // nohang was true and process has not exited
1768 child_exited = 0;
1769 break;
1770 case -1 :
1771 error_ = errno;
1772 break;
1773 default :
1774 // process has exited
1775 ppid_ = 0;
1776 status_ = exit_status;
1777 child_exited = 1;
1778 // Close wpipe, would get SIGPIPE if we used it.
1779 destroy_buffers(pstdin);
1780 close_fd(wpipe_);
1781 // Must free read buffers and pipes on destruction
1782 // or next call to open()/close()
1783 break;
1784 }
1785 }
1786 return child_exited;
1787 }
1788
1789 /**
1790 * Sends the specified signal to the process. A signal can be used to

Callers 1

openMethod · 0.95

Calls 1

close_fdFunction · 0.85

Tested by

no test coverage detected