Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99629

python response slow when running external DLL

Newsgroups comp.lang.python
Date 2015-11-26 23:51 -0800
Message-ID <dc290806-c537-4546-b802-88dff14d81c0@googlegroups.com> (permalink)
Subject python response slow when running external DLL
From jfong@ms4.hinet.net

Show all headers | View raw


I am new to Python. As an exercise of it, I try to port a program which was written more than 10 years ago. This program use the Borland C++ Builder as its GUI front end and a DLL does the real work(it will takes a few seconds to complete). I saw a strange phenomenon in the following codes. The "var_status.set('Download...')" statement seems was deferred and didn't show up until the external DLL job was finished and I can only saw the result of "var_status.set('Download OK')" statement which immediately follows. I try to do the DLL function in a thread(selected by using the "test" flag in codes), but it didn't help.

Can anyone tell me what's the point I was missed?

-------------------------
def download():
    global iniFilename
    if test:  global result, busy
    ini = iniFilename
    iniFilename = "c:\\$$temp.in3"
    saveIniFile()
    iniFilename = ini
    #do the rest
    var_status.set('Download...')
    if not test:
        result = mydll.SayHello()
    else:
        busy = True
        _thread.start_new_thread(td_download, ())
        while busy:  pass
    if result:
        var_status.set("Download Fail at %s" % hex(result))
        showerror('Romter', 'Download Fail')
    else:
        var_status.set('Download OK')            
        showinfo('Romter', 'Download OK')

if test:
result = 0x5555
busy = True
def td_download():
    global busy, result
    result = mydll.SayHello()
    busy = False
--------------------------

Best Regards,
Jach

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

python response slow when running external DLL jfong@ms4.hinet.net - 2015-11-26 23:51 -0800
  Re: python response slow when running external DLL Peter Otten <__peter__@web.de> - 2015-11-27 10:18 +0100
    Re: python response slow when running external DLL jfong@ms4.hinet.net - 2015-11-27 03:14 -0800
      Re: python response slow when running external DLL Peter Otten <__peter__@web.de> - 2015-11-27 13:20 +0100
        Re: python response slow when running external DLL jfong@ms4.hinet.net - 2015-11-27 23:37 -0800
          Re: python response slow when running external DLL Peter Otten <__peter__@web.de> - 2015-11-28 11:13 +0100
            Re: python response slow when running external DLL jfong@ms4.hinet.net - 2015-11-28 18:55 -0800
              Re: python response slow when running external DLL jfong@ms4.hinet.net - 2015-11-30 17:03 -0800
              Re: python response slow when running external DLL Peter Otten <__peter__@web.de> - 2015-12-01 12:01 +0100
                Re: python response slow when running external DLL jfong@ms4.hinet.net - 2015-12-01 19:58 -0800
          Re: python response slow when running external DLL Laura Creighton <lac@openend.se> - 2015-11-28 11:51 +0100
            Re: python response slow when running external DLL jfong@ms4.hinet.net - 2015-11-28 19:04 -0800
      Re: python response slow when running external DLL Laura Creighton <lac@openend.se> - 2015-11-27 13:49 +0100

csiph-web