Results 1 to 3 of 3

Thread: Custom Event or Queued Connection ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2006
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Custom Event or Queued Connection ?

    Hi,

    I am working on a plugin based system. Each plugin will run in a different thread. And the thread uses pthreads ( legacy code and don't intend to chage it ). Each thread is assigned a callback fucntion of the PluginManager.

    Now when the plugin wants to communicate something to the PluginManager ; it call the callback function. Now the PluginManager needs to communicate to GUI.

    Currently, we are calling the GUI ( Qt ) code from the callback function itself. And it works fine (as, for now there is only a single plugin ). But when there are more that one plugins then, we need to set mutex for the callback functions. And each thread has to wait for the mutex to get released , Since the callback function calls the Qt code, each thread has to wait more than necessary.

    So I was thinking of using Custom Events or Queued connection. And I am confused which method to go with. Or what are the pros and cons of each ?

    What I want after the implementation is, that the callback will raise an event or signal and just leave( so that the other threads need not wait for the GUI code to get executed ). And the event handler has to be invoked later. Ya, mostly like a Event mechanism.

    Could you guys please help ?

    Edited:
    I forgot to tell that the PluginManager is not QObject sublcass, so is Queued Connection an option ? Since only QObject subclasses can emit a signal.
    Last edited by vishwanath; 22nd November 2006 at 12:08.

Similar Threads

  1. QDockWidget-title
    By moowy in forum Qt Programming
    Replies: 18
    Last Post: 23rd April 2014, 20:13
  2. delete custom event
    By Dmitry in forum Qt Programming
    Replies: 1
    Last Post: 15th October 2006, 16:55
  3. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  4. Replies: 16
    Last Post: 7th March 2006, 15:57
  5. queued signal/slot connection with QList<int>
    By smalls in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 14:32

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.