public inbox for
 help / color / mirror / Atom feed
From: Fedin Pavel <>
To: Roland Schwingel <>
Subject: Re: Insight freezes on Windows 7
Date: Fri, 22 Mar 2013 09:33:00 -0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 22.03.2013 12:00, Roland Schwingel wrote:
> >   I am trying to use Insight on Windows 7, and have problems. Under
> > certain conditions it freezes and GUI stops responding.
> I am a regular user of insight on Windows 7 64bit. I use insight both 
> for 32 and 64bit mingw targets and do not have hangs.
> I am not using open target but will try to reproduce this.
> Which tcl/tk version do you use? I am using a stock tcl/tk 8.6.0. All 
> versions before did had serious problems for me on windows 64bit. I am 
> quite happy with 8.6
  I have just checked out and built Insight. So i am using bundled 
version of tcl/tk.
  By this time i have found the reason for the problem. Opening a serial 
port inside TCL is tricky. I noticed that it uses overlapped mode, and 
also it creates separate thread for writing. Also looks like it 
registers the handle within main loop in order to support event-based 
reading (at least i expect it to be implemented in such a way). I have 
noticed that write implementation is very hacky (it uses 
TerminateThread() in order to stop the thread, which is not good at all).
  Currently i suggest that there is some mis-synchronization between 
this mechanism and main event loop which is triggered by quick 
open-close sequence. When i debugged the problem even a single printf() 
in C code after opening port handle appeared to cure it. Such behavior 
(and also the fact that on another machine it is not reproduced)  
usually clearly indicates some kind of races.
  Changing RWDR open mode to RDONLY fixes the problem. I will use this 
as a workaround, complete fix of TCL interpreter isn't my goal because 
i'm not going to use it outside of Insight.
  And one more note about port listing. It works incorrectly if your 
ports are not numbered in a sequence. This is quite normal situation 
with USB-Serial adapters which are quite widespread nowadays. For 
example, on my system i happen to have COM1, COM9 and COM10. Since i 
don't have COM5 the enumeration lists only COM1.
  I think it would be more correct to enumerate serial ports via 
registry or DeviceManager (or whatever it is called - i forgot) API. 
Unfortunately i totally forgot how to do it by now - i have done this 
once several years ago. But one can take a look at, for example, in order 
to learn how to do device enumeration on Windows.

  Kind regards
  Pavel Fedin
  Expert engineer, Samsung R&D Institute Rus

  reply	other threads:[~2013-03-22  9:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22  8:01 Roland Schwingel
2013-03-22  9:33 ` Fedin Pavel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-03-22  7:23 Fedin Pavel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).