Results 1 to 5 of 5

Thread: Please critique: solution to database connection and multiple threads

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Please critique: solution to database connection and multiple threads

    This is coming a bit late, especially since you have moved away from your one-connection-per-thread solution, but if you ever have to do something like that again, consider using thread-local storage (see QThreadStorage for Qt's implementation) instead of rolling out your own map protected by a mutex. Thread-local storage is supported by the C11 and C++11 standards, and is usually natively supported by the OS. IIRC a typical implementation consists in reserving a CPU register that points to a different memory area for each thread.

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

    Urthas (22nd October 2015)

Similar Threads

  1. Threads and database connection
    By probine in forum Qt Programming
    Replies: 9
    Last Post: 7th August 2013, 08:30
  2. SignalSlot Connection across the threads
    By shruti in forum Newbie
    Replies: 9
    Last Post: 29th March 2013, 10:30
  3. Replies: 5
    Last Post: 20th January 2013, 18:06
  4. Replies: 0
    Last Post: 21st April 2010, 19:13
  5. SQLite connection shared by several threads
    By jorgegarciar in forum Qt Programming
    Replies: 1
    Last Post: 23rd August 2009, 20:15

Tags for this Thread

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.