fixed two minor bugs in main.c

This commit is contained in:
hyunghwan.chung 2017-03-09 13:39:59 +00:00
parent 3bfffe09d9
commit 6a2add620b

View File

@ -566,7 +566,7 @@ static int write_all (int fd, const char* ptr, moo_oow_t len)
{ {
moo_ooi_t wr; moo_ooi_t wr;
wr = write (1, ptr, len); wr = write (fd, ptr, len);
if (wr <= -1) if (wr <= -1)
{ {
@ -838,9 +838,11 @@ static void vm_cleanup (moo_t* moo)
#else #else
xtn_t* xtn = (xtn_t*)moo_getxtn(moo); xtn_t* xtn = (xtn_t*)moo_getxtn(moo);
#if defined(USE_THREAD) #if defined(USE_THREAD)
if (xtn->iothr_up) if (xtn->iothr_up)
{ {
xtn->iothr_abort = 1;
write (xtn->p[1], "Q", 1); write (xtn->p[1], "Q", 1);
pthread_cond_signal (&xtn->ev.cnd); pthread_cond_signal (&xtn->ev.cnd);
pthread_join (xtn->iothr, MOO_NULL); pthread_join (xtn->iothr, MOO_NULL);