Results 1 to 7 of 7

Thread: Threads or Event loop in multiplayer hangman game

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Threads or Event loop in multiplayer hangman game

    Quote Originally Posted by Anisha Kaul View Post
    What is an event loop?
    An event loop is a construct where a thread runs in a loop, in which it waits for events. Whenever it gets any event, that could be user interaction or timers or data arriving at sockets, etc, the thread will process them and finally return to waiting.

    Basically something like

    Qt Code:
    1. while (true) {
    2. Event *event = getEvent();
    3. processEvent(event);
    4. }
    To copy to clipboard, switch view to plain text mode 

    Quote Originally Posted by Anisha Kaul View Post
    do I need that?
    You already have that as part of your Qt application object. You start the event loop when you code in main() calls exec().
    This main thread event loop handles all the UI events, but can of course also handle others.

    Cheers,
    _

  2. The following user says thank you to anda_skoa for this useful post:

    TheIndependentAquarius (1st March 2014)

Similar Threads

  1. Replies: 4
    Last Post: 6th August 2011, 01:40
  2. Replies: 10
    Last Post: 15th January 2010, 14:35
  3. Replies: 0
    Last Post: 23rd October 2008, 12:43
  4. signal and slot across threads having event loop
    By travis in forum Qt Programming
    Replies: 6
    Last Post: 5th November 2007, 23:56
  5. Making 3D controls in QT, implementing a game loop in QT
    By smurrish in forum Qt Programming
    Replies: 10
    Last Post: 26th April 2006, 04:37

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
  •  
Qt is a trademark of The Qt Company.