Results 1 to 7 of 7

Thread: QWebSocketServer howto move new connections to a own thread

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebSocketServer howto move new connections to a own thread

    Quote Originally Posted by M4chin3 View Post
    Why?
    Because usually the number of threads you can spawn per process or per user is limited. By opening a large number of concurrent connections I'd either force your app to run out of threads or starve it by flooding it with context switching.

    Why threads? -> Maybe every connection can do a blocking operation in my application and therefore I want to decouple them from the rest of the application/listener.
    Then you want to perform that blocking operation in another thread (or better yet using a limited thread pool) and not push the whole communication there. You can decouple whatever you want decoupled by encapsulating it in an object. You don't require threads for that.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Mar 2013
    Posts
    29
    Thanks
    4
    Thanked 4 Times in 2 Posts

    Default Re: QWebSocketServer howto move new connections to a own thread

    By decoupling I meant moving the task to another thread to avoid blocking the whole program. But basically you're right, I can move the blocking tasks to threads and keep the connections all together within another thread. I'm not worrying about the number of threads shouldn't be so many, but I'm giving the limited thread pool a thought.

    Thanks!

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWebSocketServer howto move new connections to a own thread

    Quote Originally Posted by M4chin3 View Post
    I'm not worrying about the number of threads shouldn't be so many
    Right... and 640kB or RAM should be enough for anybody
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 11
    Last Post: 12th September 2012, 16:25
  2. Replies: 1
    Last Post: 4th September 2012, 14:13
  3. multithread thread don't move
    By lzpmail in forum Qt Programming
    Replies: 11
    Last Post: 28th March 2011, 09:09
  4. Replies: 1
    Last Post: 30th July 2010, 07:23
  5. howto Processing GUI events until a thread exits
    By doggrant in forum Qt Programming
    Replies: 0
    Last Post: 5th October 2009, 15:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.