diff options
author | Lukas Larsson <[email protected]> | 2014-03-12 15:58:03 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2014-03-23 22:16:18 +0100 |
commit | ebad8e4c3a26e5ed3813ede2ca539123a1d31812 (patch) | |
tree | 042b78a672e63677efc6a62d3230aa225610b156 | |
parent | 483161dd3e05d5d4285bae90ac625e761c7b8214 (diff) | |
download | otp-ebad8e4c3a26e5ed3813ede2ca539123a1d31812.tar.gz otp-ebad8e4c3a26e5ed3813ede2ca539123a1d31812.tar.bz2 otp-ebad8e4c3a26e5ed3813ede2ca539123a1d31812.zip |
ose: Reset busy port when pdq empty
-rw-r--r-- | erts/emulator/sys/ose/sys.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/erts/emulator/sys/ose/sys.c b/erts/emulator/sys/ose/sys.c index e3041ff1ca..6e6303820c 100644 --- a/erts/emulator/sys/ose/sys.c +++ b/erts/emulator/sys/ose/sys.c @@ -1394,16 +1394,15 @@ static void ready_output(ErlDrvData drv_data, ErlDrvEvent ready_fd) driver_failure_posix(data->port_num, status); } else { /* written bytes > 0 */ - iov = driver_peekq(data->port_num, &vlen); - if (vlen > 0) { - DISPATCH_AIO(sig); - FREE_AIO(sig->fm_write_reply.buffer); - res = driver_deq(data->port_num, iov[0].iov_len); - if (res > 0) { - iov = driver_peekq(data->port_num, &vlen); - WRITE_AIO(data->ofd, iov[0].iov_len, iov[0].iov_base); - } - } + DISPATCH_AIO(sig); + res = driver_deq(data->port_num, sig->fm_write_reply.actual); + FREE_AIO(sig->fm_write_reply.buffer); + if (res == 0) + set_busy_port(data->port_num, 0); + else { + iov = driver_peekq(data->port_num, &vlen); + WRITE_AIO(data->ofd, iov[0].iov_len, iov[0].iov_base); + } } sig = erl_drv_ose_get_signal(ready_fd); } |