Results 1 to 2 of 2

Thread: Atomic Integer Support for Desktop and Embedded Platforms (in source format)

  1. #1
    Join Date
    Nov 2010
    Posts
    122
    Thanks
    62
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Cool Atomic Integer Support for Desktop and Embedded Platforms (in source format)

    I am developing a small library with both desktop (Linux, Windows, MacOS) and embedded system targets. My library would have to
    be provided in binary form for specific platforms, or in source code format for perhaps some embedded platforms where I do not
    have the proper build environment. My goals is to have all the required source code as one code base.

    This library requires support for a couple of atomic integer operations, atomic increment (QAtomicInt.fetchAndAddStore()) and
    test and set (QAtomicInt.testAndSetOrdered()) to implement non-locking non-waiting thread safe access to acquisition memory. In the
    current implementation using Qt, the use of QAtomicInt is both non-locking and non-waiting, and fast, which is a fundamental requirement of the
    implementation. This is currently implemented for a large application running under Linux/Windows using the Qt framework, staticly linking to the QtCore library.

    Since some of the potential target platforms is embedded systems sensitive to library footprint, my goal is to keep the library as small
    as possible. Certainly I could link in the QCore library for desktop environments that are not sensitive to size, but I prefer to
    embedded just the Atomic APIs in my application code to minimize the footprint.

    So my considerations are quite wide and varied.

    1. I could pull out the atomic source files from the Qt source repo (e.g. 'qt-everywhere-opensource-src-4.8.4\src\corelib\arch')

    2. I could use std:atomic, but this is not supported in legacy compilers (including MSVS2008/MSVC2010), so therefore unlikely for embedded systems.

    3. I could use the Boost library, perhaps pull out only the relevant source for atomics.

    4. I could use the Intel Thread BUilding Blocks (TBB) atomic, but back again to the issue of footprint when I only need some very
    small features and not the entire library. Note that TBB is built for dynamic linking, not static.

    5. I could attempt to use the OpenMP atomic statement (#pragma omp atomic), but this does not have support for test and set
    (to my knowledge) and requires specific compiler support, so might not be available for some embedded targets.

    6. Other?

    Anyone attempt to do something similar and have any advise to achieve my goals on small size, code that is part of my
    library, no dynamic links, no shared library to redistribute, etc.

    Has anyone attempted to build small sections of the QtCore library or embed small sections into their own code base.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Atomic Integer Support for Desktop and Embedded Platforms (in source format)

    In general I would say that the proper approach depends on the platforms you wish to support. Some architectures support atomic operations directly using CPU instructions, others have to emulate it. Atomic operations are a fundamental part of Qt but only for platforms Qt supports. I think you should assemble a list of platforms you wish to support and then simply find implementations for all of them in the net. If you wish, you can extract needed code from Qt if the licence allows it or just google for alternate (per platform) solutions.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    bob2oneil (1st February 2014)

Similar Threads

  1. Replies: 0
    Last Post: 21st October 2011, 12:01
  2. Phonon Media Format Support
    By somnathbanik in forum Newbie
    Replies: 11
    Last Post: 2nd February 2011, 05:52
  3. SVG format - filter support
    By Tomasz in forum Newbie
    Replies: 0
    Last Post: 27th October 2010, 13:51
  4. Support for .rtf format in QTextDocument or QTextEdit?
    By LynneV in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2010, 23:01
  5. QImageIOPlugin, support for new image format.
    By suneel1310 in forum Qt Programming
    Replies: 12
    Last Post: 6th March 2009, 10:21

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.