Results 1 to 4 of 4

Thread: _beginthread

  1. #1
    Join Date
    Jul 2009
    Posts
    39
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default _beginthread

    I tried to use _beginthread with widgets, I got errors.

    So I moved to QThread, but my function which I pass to _beginthread uses global variables, and I don't want to pass these variables as parameters. Is there any function in QT which I can use instead of _beginthread ?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: _beginthread

    Quote Originally Posted by metdos View Post
    but my function which I pass to _beginthread uses global variables, and I don't want to pass these variables as parameters.
    Simply use global variables inside the QThread::run() function
    Last edited by mcosta; 24th July 2009 at 15:39. Reason: spelling error
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: _beginthread

    If you are using global variables, don't forget to lock them.

  4. #4
    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: _beginthread

    A direct equivalent of _beginthread would be QtConcurrent::run().
    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.


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.