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. Concurrent access with threads

Concurrent access with threads

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.8k Views
  • 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.
  • S Offline
    S Offline
    SamFaye
    wrote on last edited by
    #1

    I have a SQLite database. I want to write unit tests to verify the behavior of the database during a concurrent access. How can I use threads to make a concurrent access?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xander84
      wrote on last edited by
      #2

      did you read this article about concurrency with Qt? http://qt-project.org/doc/qt-5.0/qtcore/thread-basics.html

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Hi,

        Qt classes does not support multithreaded access to SQL databases, unfortunately: http://qt-project.org/doc/qt-5/threads-modules.html#threads-and-the-sql-module

        If you still want to use concurrent access, you can use Qt to create threads, and then use the native SQLite API to do reading.

        However, note that SQLite already has built-in read/write locks that are rigorously tested (See Q5 and Q6 at https://sqlite.org/faq.html ). Do you need to test it yourself?

        [quote author="Xander84" date="1396465160"]did you read this article about concurrency with Qt? http://qt-project.org/doc/qt-5.0/qtcore/thread-basics.html[/quote]That link is outdated and incomplete. For generic info about multithreading in Qt, see these instead:

        • http://qt-project.org/doc/qt-5/threads.html (recommended)
        • http://qt-project.org/doc/qt-5/thread-basics.html

        (Please provide links to the latest version of the documentation -- the Qt 5.0 documentation has many issues)

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SamFaye
          wrote on last edited by
          #4

          Hi
          I'm back. I explain you what I wante to do. I'm new in threads.
          Here's what I want:
          @I want to create a Unit test that simulate the concurrent access. So I want to creat 2 unit test: one insert data into a table "TOTO" and an other insert data to the same table at the same moment. How can I implement and run at the same moment my unit tests? Please Jus an example.@

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            Hi,

            See http://qt-project.org/forums/viewthread/41164/

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            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