From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20132 invoked by alias); 22 Mar 2013 09:33:31 -0000 Mailing-List: contact insight-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sourceware.org Received: (qmail 19859 invoked by uid 89); 22 Mar 2013 09:31:38 -0000 X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mailout3.w1.samsung.com (HELO mailout3.w1.samsung.com) (210.118.77.13) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 22 Mar 2013 09:31:34 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MK200G8D2G8ZI30@mailout3.w1.samsung.com> for insight@sourceware.org; Fri, 22 Mar 2013 09:31:32 +0000 (GMT) Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 22.43.06366.4F42C415; Fri, 22 Mar 2013 09:31:32 +0000 (GMT) Received: from [106.109.9.113] by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MK2006SU2GJVN10@eusync2.samsung.com> for insight@sourceware.org; Fri, 22 Mar 2013 09:31:32 +0000 (GMT) Message-id: <514C24F3.6050302@samsung.com> Date: Fri, 22 Mar 2013 09:33:00 -0000 From: Fedin Pavel User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:10.0) Gecko/20120206 Thunderbird/10.0 MIME-version: 1.0 To: Roland Schwingel Cc: insight@sourceware.org Subject: Re: Insight freezes on Windows 7 References: <514C0F98.7030704@onevision.com> In-reply-to: <514C0F98.7030704@onevision.com> Content-type: text/plain; charset=ISO-8859-15; format=flowed Content-transfer-encoding: 7bit X-SW-Source: 2013-q1/txt/msg00037.txt.bz2 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, http://www.codeproject.com/Articles/14469/Simple-Device-Manager in order to learn how to do device enumeration on Windows. -- Kind regards Pavel Fedin Expert engineer, Samsung R&D Institute Rus