Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › settings thread safe?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16440

    Bas

    hi,

    i have a small c++ class that acts like a socket server, so i can have a few clients connected from another app.

    the server app needs to store some personal data, and i was wondering if settings is thread safe?

    greetings,

    Bas

    #16447

    Günther
    Felgo Team

    Hi Bas!

    The settings (Storage component) uses a Qt Quick Local Storage database for storing the key-value pairs.

    It is thread-safe as far as single read or write operations are concerned. Each get or set action is executed as a single transaction on the database.
    When using multiple read or write operations in different threads, race conditions can thus occur as the database transaction always only covers single read or write commands.

    Cheers,
    Günther from Felgo

     

     

     

    #16448

    Bas

    hi Gunther,

    ok , now I have a javascript object in wich I have different keys for users, and want to store that tree in de settings db.

    but maybe I can make a copy of the structure and store that object.

    but I do not know when the next client is going to sent data which I have to store in the object.

    or I have to make a SQLite db for every client.

    I also ran into this page: http://www.sqlite.org/threadsafe.html

    so I do not know in what mode SQLite is compiled in QT.
    single / multi thread or Serialized

     

     

    SQLite supports three different threading modes:

    1. <b>Single-thread</b>. In this mode, all mutexes are disabled and SQLite is unsafe to use in more than a single thread at once.
    2. <b>Multi-thread</b>. In this mode, SQLite can be safely used by multiple threads provided that no single database connection is used simultaneously in two or more threads.
    3. <b>Serialized</b>. In serialized mode, SQLite can be safely used by multiple threads with no restriction.

     

    #16455

    Günther
    Felgo Team

    The actual threading mode depends on how SQLite is included by Qt Quick Local Storage, but as the default threading mode is Serialized, I assume you can also expect the Qt Quick Local Storage to fully work in multi-threaded environment. To be 100% sure about the SQLite configuration and for more information on the actual implementation, please consider asking in the official Qt forums.

    Best,
    Günther

Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded