Skip to content
Tcl Source Code Artifact [6169669eda]
Login

Artifact [6169669eda]

Artifact 6169669edafe69e16477b6bb0b0fc3daeba8f1f6:

Ticket change [6169669eda] - New ticket [2913585fffffffff|2913585fff] <i>[win32] serial channel blocks indefinitely on write</i>. by a_kovalenko on 2009-12-13 08:35:32.
D 2009-12-13T08:35:32
J assignee andreas_kupries
J cmimetype text/plain
J comment 1.\sset\sfd\s[\sopen\sCOM5:\sr+]\n\s\s\s\sfconfigure\s$fd\s-blocking\sno\n\s\s\s\sputs\s$fd\ssomething\n\s\s\s\sclose\s$fd\nHangs\sindefinitely\sin\sSerialBlockingWrite()\swhen\sthe\sport\sis\snot\sconnected.\n2.\sif\swe\suse\s-blocking\syes\sinstead,\sclose\s$fd\sseems\sto\ssucceed,\sbut\s_leaves\san\sopen\shandle\sand\sa\srunning\sSerialWriterThread_\sforever:\sso\swe\sget\s"permission\sdenied"\swhen\strying\sto\sreopen\sthe\sport.\n\nWrite\stimeout\sis\signored\son\sWindows\s(it's\sdocumented\sat\sthe\sopen\sman\spage,\sand\salso\sobvious\sfrom\sthe\scode).\n\nThe\serror\sis\sfixable\sin\smany\sways,\sof\swhich\sI\scan't\sselect\sthe\sbest\sone\syet.\sThe\sproblem\sis\sthat\sGetOverlappedResult()\sin\sSerialBlockingWrite()\swaits\sforever\s(an\sinteresting\sthing\sis\sthat\sthe\scode\sbelow\shandles\sERROR_COUNTER_TIMEOUT,\sthough\sit\scan\snever\sreally\shappen).\sForwarding\sthe\swrite\stimeout\sto\sSetCommTimeouts()\swould\sat\sleast\sgive\sme\san\sability\sto\sclose\sthe\sport\ssomehow.\sEnsuring\sthat\sthe\shandle\sis\snot\sopen\safter\ssuccessful\s[close\s$fd],\swhether\s\sits\smode\sis\sblocking\sor\snon-blocking,\swould\salso\sbe\sa\sgood\spractice\s(thus\savoiding\sthe\sawful\snon-blocking\scase\sdescribed\sabove,\swhen\sthe\shandle\sis\sinaccessible\sby\sTCL\sbut\scontinues\sto\shold\sthe\sdevice\sin\sbusy\sstate).\s\n\nAlso,\s[chan\scancel]\sfor\sall\spending\sIO\swould\sbe\sa\sgood\saddition,\sbut\sit's\smore\sabout\slong-term\sTCL\sdevelopment\splans.\n\nIt\smay\shappen\sthat\sthere\sis\san\seasy\sworkaround\sfor\s_usual_\s(UART16550A\sPC)\sserial\sports:\sputting\sthem\sinto\s-handshake\snone\smode,\swhen\sall\spending\swrites\sshould\ssucceed\simmediately.\sHowever,\sit\sdoesn't\shelp\swith\smany\sother\sCOMM\sdevices,\slike\scom0com-forwarded\schannels,\sBluetooth\svirtual\sserial\sports\sand\s(maybe)\ssome\sUSB2RS232\sadaptors.\sThis\sdifference\sexplains\swhy\sthis\serror\scould\slive\sunnoticed\sfor\sso\slong.
J foundin obsolete:\s8.6b1.1
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter a_kovalenko
J subsystem 25.\sChannel\sSystem
J title [win32]\sserial\schannel\sblocks\sindefinitely\son\swrite
J type Bug
K 2913585fffffffffffffffffffffffffffffffff
U a_kovalenko
Z 0a9c8c3f74e3153b5436bd05ac723ff6