Detach the stdin write thread so that it is auto-cleaned up

This commit is contained in:
Kovid Goyal 2019-06-12 20:36:53 +05:30
parent 95b9b2d373
commit f151f4c165
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -231,7 +231,6 @@ start(PyObject *s, PyObject *a UNUSED) {
Py_RETURN_NONE;
}
static PyObject *
wakeup(PYNOARG) {
#define wakeup_doc "wakeup() -> wakeup the ChildMonitor I/O thread, forcing it to exit from poll() if it is waiting there."
@ -793,6 +792,7 @@ cm_thread_write(PyObject UNUSED *self, PyObject *args) {
memcpy(data->buf, buf, data->sz);
int ret = pthread_create(&thread, NULL, thread_write, data);
if (ret != 0) { free_twd(data); return PyErr_SetFromErrno(PyExc_OSError); }
pthread_detach(thread);
Py_RETURN_NONE;
}