diff options
author | Steve Bennett <steveb@workware.net.au> | 2016-10-19 07:51:46 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2016-10-19 07:51:46 +1000 |
commit | b464e52b99e0a44d8a0fae616b193bd2250e209b (patch) | |
tree | c5943775c942a432378e9920cd4101bdd0cef118 /examples | |
parent | 8503e9e27495141813a325a6cc770d3550c889c3 (diff) | |
download | jimtcl-b464e52b99e0a44d8a0fae616b193bd2250e209b.zip jimtcl-b464e52b99e0a44d8a0fae616b193bd2250e209b.tar.gz jimtcl-b464e52b99e0a44d8a0fae616b193bd2250e209b.tar.bz2 |
examples/tip.tcl: Lock the device
Prevent multiple access to a serial port by using locking.
This is probably compatible with most serial port locking on Linux.
Perhaps on macosx.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/tip.tcl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/tip.tcl b/examples/tip.tcl index 2770dcb..3de25e3 100755 --- a/examples/tip.tcl +++ b/examples/tip.tcl @@ -82,6 +82,11 @@ try { return 1 } +if {[$f lock] == 0} { + puts "Device is in use: $device" + return 1 +} + try { $f tty {*}$settings } on error msg { |