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. QThread stack-address
Forum Updated to NodeBB v4.3 + New Features

QThread stack-address

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    fridbert
    wrote on last edited by
    #1

    Greetings,

    I use Qt4.8 on Windows and I´m searching a way of getting the stack-address of a QThread or
    set the stack myself.

    With pthreads it´s possible to get/set the stack-pointer by pthread_attr_getstack() and
    pthread_attr_setstack().
    Since QThreads are built upon pthreads there should be a solution but I only found
    QThread::setStackSize and I don´t like the idea of running a pthread in my QtApp only
    because of getting the address.

    The reason I need this is preventing the garbagecollection of my embedded interpreter
    which lives in a QThread from running amok ( http://bugs.ruby-lang.org/issues/2294 )

    I would be really thankful for getting some help/advice (also if it´s just telling me that it´s not possible -.-)

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

      Well it is based on pthread on UNIX systems but on native Windows threads on Windows. Qt is a cross-platform API and provides access to what can be used in a cross-platform way. The address of the stack must therefore not be portable, otherwise it would be part of the API.
      QThread was not really intended to be subclassed with @QThread::run()@ overloaded and used to fire up custom threads anyway. The initial design goal was to create a secondary event-loop in which QObjects could live and handle signals/events without blocking the main GUI thread. @QObject::moveToThread()@ is used for just that.
      So for your specific platform-related need, I think you'll have to go the platform-specific way and create your own pthread/native thread and use the platform API to achieve what you want.
      Hope this helps!

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fridbert
        wrote on last edited by
        #3

        Helps a lot. Thank you very much for explaining rcari.

        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