X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fio%2Fserial.cpp;h=b4cfaab4726718bbfaa5f450cd3c1d7e1bcf29eb;hb=481b844ed7d180ffbf70223075f2fc1ffdb5b444;hp=cf2c6952bf3d7e97eb52eb0102f5253549aa03da;hpb=609c9a508cfdc7b42c46c4f21d17639204165a00;p=libs%2Fcore.git diff --git a/source/io/serial.cpp b/source/io/serial.cpp index cf2c695..b4cfaab 100644 --- a/source/io/serial.cpp +++ b/source/io/serial.cpp @@ -42,7 +42,7 @@ void Serial::close() void Serial::set_block(bool b) { - mode = b?(mode&~M_NONBLOCK):(mode|M_NONBLOCK); + adjust_mode(mode, M_NONBLOCK, !b); sys_set_blocking(handle, b); } @@ -120,5 +120,11 @@ unsigned Serial::do_read(char *buf, unsigned size) return ret; } +const Handle &Serial::get_handle(Mode m) +{ + check_access(m); + return handle; +} + } // namespace IO } // namespace Msp