Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. is QSerialPortInfo::availablePorts() blocking on Windows

is QSerialPortInfo::availablePorts() blocking on Windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 392 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jan Krejsa
    wrote on last edited by
    #1

    I have found out, that when I plug USB device into the computer, there is some extra time needed, until the function returns back. That happens only when the device is enumerated. Once done, function returns immediately. Knowing that, I have tried to moved this calls to the different thread and surprisingly it blocks the GUI threads as well. Blocking is about 1-2 seconds.

    is that expected behavior? Shall I move it to separate process ?

    Thank you, Jan

    jsulmJ 1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by mchinand
      #2

      You could call it with a QtConcurrent::run() and use a QFutureWatcher to call a slot that processes the results. That way it should be asynchronous and not block the UI.

      1 Reply Last reply
      0
      • J Jan Krejsa

        I have found out, that when I plug USB device into the computer, there is some extra time needed, until the function returns back. That happens only when the device is enumerated. Once done, function returns immediately. Knowing that, I have tried to moved this calls to the different thread and surprisingly it blocks the GUI threads as well. Blocking is about 1-2 seconds.

        is that expected behavior? Shall I move it to separate process ?

        Thank you, Jan

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Jan-Krejsa said in is QSerialPortInfo::availablePorts() blocking on Windows:

        I have tried to moved this calls to the different thread and surprisingly it blocks the GUI threads as well.

        Can you show how you did it?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved