Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Computer falls asleep while Qt Creator is building a large project
Forum Updated to NodeBB v4.3 + New Features

Computer falls asleep while Qt Creator is building a large project

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
23 Posts 5 Posters 3.4k Views 3 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.
  • D Offline
    D Offline
    DeepSOIC
    wrote on last edited by
    #1

    I am coding FreeCAD on Windows with Qt Creator 4.13.0. A full build of FreeCAD takes more than 25 minutes, and if i leave my laptop unattended, it falls asleep, suspending the build.

    It kinda sucks when I leave the laptop compiling, and then come back to find out that laptop fell asleep and FreeCAD isn't even halfway compiled. It would have been nice if Qt Creator could prevent the computer from auto falling asleep until the build is finished.

    I have looked through the settings of Qt Creator, and have not found anything for that. Is it possible?

    If someone is going to implement it, on windows it can be controlled by SetThreadExecutionState function.

    JonBJ 1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by aha_1980
      #2

      Please report this on Qt bugtracker.

      (Z(:^

      D 1 Reply Last reply
      1
      • D DeepSOIC

        I am coding FreeCAD on Windows with Qt Creator 4.13.0. A full build of FreeCAD takes more than 25 minutes, and if i leave my laptop unattended, it falls asleep, suspending the build.

        It kinda sucks when I leave the laptop compiling, and then come back to find out that laptop fell asleep and FreeCAD isn't even halfway compiled. It would have been nice if Qt Creator could prevent the computer from auto falling asleep until the build is finished.

        I have looked through the settings of Qt Creator, and have not found anything for that. Is it possible?

        If someone is going to implement it, on windows it can be controlled by SetThreadExecutionState function.

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by
        #3

        @DeepSOIC said in Computer falls asleep while Qt Creator is building a large project:

        it falls asleep

        LOL, sorry, couldn't help chuckling! Maybe it finds compiling boring ;-)

        1 Reply Last reply
        0
        • sierdzioS sierdzio

          Please report this on Qt bugtracker.

          D Offline
          D Offline
          DeepSOIC
          wrote on last edited by
          #4

          @sierdzio created https://bugreports.qt.io/browse/QTCREATORBUG-24682
          oh, and by the way, i forgot to say. Qt Creator is great!

          1 Reply Last reply
          2
          • D Offline
            D Offline
            DeepSOIC
            wrote on last edited by
            #5

            Unfortunately, the tracker ticket was promptly closed =(
            Oh, well, i guess i have to up my idle timer.

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              Shame. I think it would have been a useful feature.

              (Z(:^

              1 Reply Last reply
              0
              • JonBJ Online
                JonBJ Online
                JonB
                wrote on last edited by
                #7

                It doesn't seem like the right/responsibility of a compiler or maker or builder to keep a computer awake so it keep going. I assume if you want something like this you would need a "governor" service which you told what you wanted to keep awake for from running programs, and prevent sleep of that can be done?

                D 1 Reply Last reply
                0
                • JonBJ JonB

                  It doesn't seem like the right/responsibility of a compiler or maker or builder to keep a computer awake so it keep going. I assume if you want something like this you would need a "governor" service which you told what you wanted to keep awake for from running programs, and prevent sleep of that can be done?

                  D Offline
                  D Offline
                  DeepSOIC
                  wrote on last edited by
                  #8

                  @JonB
                  i'm sure it can be done with a special governor... but being yet another perpetual background process, this solution for me is ugly at best.
                  My computer doesn't sleep when i talk on skype. I don't have to set up a governor for that, it just works.
                  My computer plays youtube for however long i like, there is no governor for that. Or plays music.
                  My computer controls a 3d-printer, doesn't sleep, there is no governor (though i usually still change the power plan to "never sleep" for this very important occasion, for good measure)

                  BTW, Moderns Standby in windows gives me trouble with the music playback (still falls asleep), but that's a topic for another discussion.

                  JonBJ 1 Reply Last reply
                  2
                  • D DeepSOIC

                    @JonB
                    i'm sure it can be done with a special governor... but being yet another perpetual background process, this solution for me is ugly at best.
                    My computer doesn't sleep when i talk on skype. I don't have to set up a governor for that, it just works.
                    My computer plays youtube for however long i like, there is no governor for that. Or plays music.
                    My computer controls a 3d-printer, doesn't sleep, there is no governor (though i usually still change the power plan to "never sleep" for this very important occasion, for good measure)

                    BTW, Moderns Standby in windows gives me trouble with the music playback (still falls asleep), but that's a topic for another discussion.

                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote on last edited by
                    #9

                    @DeepSOIC
                    Hmm, I didn't know about those not being affected by or blocking sleep.

                    So how do each of those work to achieve that?

                    sierdzioS 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @DeepSOIC
                      Hmm, I didn't know about those not being affected by or blocking sleep.

                      So how do each of those work to achieve that?

                      sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #10

                      @JonB as OP mentioned in the bug report:

                      On windows, idle sleep can be prevented by calling SetThreadExecutionState Windows API function.

                      (Z(:^

                      JonBJ 1 Reply Last reply
                      0
                      • sierdzioS sierdzio

                        @JonB as OP mentioned in the bug report:

                        On windows, idle sleep can be prevented by calling SetThreadExecutionState Windows API function.

                        JonBJ Online
                        JonBJ Online
                        JonB
                        wrote on last edited by
                        #11

                        @sierdzio
                        @DeepSOIC wrote:

                        My computer plays youtube for however long i like

                        I may [well] be old-fashioned, but I am assuming this means through a web browser, not some "app"(?). In which case, are you saying Google Chrome is making this SetThreadExecutionState call?

                        sierdzioS D 2 Replies Last reply
                        0
                        • JonBJ JonB

                          @sierdzio
                          @DeepSOIC wrote:

                          My computer plays youtube for however long i like

                          I may [well] be old-fashioned, but I am assuming this means through a web browser, not some "app"(?). In which case, are you saying Google Chrome is making this SetThreadExecutionState call?

                          sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #12

                          @JonB said in Computer falls asleep while Qt Creator is building a large project:

                          @sierdzio
                          @DeepSOIC wrote:

                          My computer plays youtube for however long i like

                          I may [well] be old-fashioned, but I am assuming this means through a web browser, not some "app"(?). In which case, are you saying Google Chrome is making this SetThreadExecutionState call?

                          Yes, Chrome. It's really nothing exotic. It's part of WinApi since Windows XP. link

                          (Z(:^

                          JonBJ 1 Reply Last reply
                          0
                          • sierdzioS sierdzio

                            @JonB said in Computer falls asleep while Qt Creator is building a large project:

                            @sierdzio
                            @DeepSOIC wrote:

                            My computer plays youtube for however long i like

                            I may [well] be old-fashioned, but I am assuming this means through a web browser, not some "app"(?). In which case, are you saying Google Chrome is making this SetThreadExecutionState call?

                            Yes, Chrome. It's really nothing exotic. It's part of WinApi since Windows XP. link

                            JonBJ Online
                            JonBJ Online
                            JonB
                            wrote on last edited by
                            #13

                            @sierdzio
                            OK, so, don't shoot me, I'm just asking/suggesting: to get the desired behaviour, can the OP write a one-line wrapper around the compiler or make command, or perhaps the invocation of Qt Creator itself, to call the desired SetThreadExecutionState? It seems it doesn't matter which application that comes from, so long as that application is running, so any wrapper should do it?

                            mrjjM D 2 Replies Last reply
                            0
                            • JonBJ JonB

                              @sierdzio
                              OK, so, don't shoot me, I'm just asking/suggesting: to get the desired behaviour, can the OP write a one-line wrapper around the compiler or make command, or perhaps the invocation of Qt Creator itself, to call the desired SetThreadExecutionState? It seems it doesn't matter which application that comes from, so long as that application is running, so any wrapper should do it?

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by mrjj
                              #14

                              @JonB
                              Hi
                              Yes it works with any tool that sets this.
                              like this one
                              https://sourceforge.net/projects/coffeeff/files/
                              that can see if Creator is running and then do it.

                              1 Reply Last reply
                              3
                              • JonBJ JonB

                                @sierdzio
                                @DeepSOIC wrote:

                                My computer plays youtube for however long i like

                                I may [well] be old-fashioned, but I am assuming this means through a web browser, not some "app"(?). In which case, are you saying Google Chrome is making this SetThreadExecutionState call?

                                D Offline
                                D Offline
                                DeepSOIC
                                wrote on last edited by
                                #15

                                @JonB
                                Firefox clearly does call that function while playing youtube. I can see it by executing powercfg -requests from elevated command prompt.

                                DISPLAY:
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                
                                SYSTEM:
                                [DRIVER] Realtek High Definition Audio (INTELAUDIO\FUNC_01&VEN_10EC&DEV_0294&SUBSYS_10431AF1&REV_1000\4&298c7770&0&0001)
                                An audio stream is currently in use.
                                
                                AWAYMODE:
                                None.
                                
                                EXECUTION:
                                None.
                                
                                PERFBOOST:
                                None.
                                
                                ACTIVELOCKSCREEN:
                                None.
                                

                                Winamp does not, apparently, but if only classic sleep (S3) is available, any audio stream keeps the computer awake. On modern sleep (S0), my laptop will sleep when winamp is playing, and it sucks (i have gone through hell to disable S0 on windows 10 v2004, maybe i should have ditched winamp instead).

                                JonBJ 1 Reply Last reply
                                1
                                • JonBJ JonB

                                  @sierdzio
                                  OK, so, don't shoot me, I'm just asking/suggesting: to get the desired behaviour, can the OP write a one-line wrapper around the compiler or make command, or perhaps the invocation of Qt Creator itself, to call the desired SetThreadExecutionState? It seems it doesn't matter which application that comes from, so long as that application is running, so any wrapper should do it?

                                  D Offline
                                  D Offline
                                  DeepSOIC
                                  wrote on last edited by
                                  #16

                                  @JonB said in Computer falls asleep while Qt Creator is building a large project:

                                  to get the desired behaviour, can the OP write a one-line wrapper around the compiler or make command, or perhaps the invocation of Qt Creator itself, to call the desired SetThreadExecutionState? It seems it doesn't matter which application that comes from, so long as that application is running, so any wrapper should do it?

                                  I think it should work. Adding a wrapper for Qt Creator is a bad idea, because i do want my computer to sleep if qt creator is just sitting there doing nothing. But a wrapper around msvc or ninja or maybe even cmake will most likely work.

                                  JonBJ 1 Reply Last reply
                                  0
                                  • D DeepSOIC

                                    @JonB
                                    Firefox clearly does call that function while playing youtube. I can see it by executing powercfg -requests from elevated command prompt.

                                    DISPLAY:
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    [PROCESS] \Device\HarddiskVolume3\Program Files\Mozilla Firefox\firefox.exe
                                    
                                    SYSTEM:
                                    [DRIVER] Realtek High Definition Audio (INTELAUDIO\FUNC_01&VEN_10EC&DEV_0294&SUBSYS_10431AF1&REV_1000\4&298c7770&0&0001)
                                    An audio stream is currently in use.
                                    
                                    AWAYMODE:
                                    None.
                                    
                                    EXECUTION:
                                    None.
                                    
                                    PERFBOOST:
                                    None.
                                    
                                    ACTIVELOCKSCREEN:
                                    None.
                                    

                                    Winamp does not, apparently, but if only classic sleep (S3) is available, any audio stream keeps the computer awake. On modern sleep (S0), my laptop will sleep when winamp is playing, and it sucks (i have gone through hell to disable S0 on windows 10 v2004, maybe i should have ditched winamp instead).

                                    JonBJ Online
                                    JonBJ Online
                                    JonB
                                    wrote on last edited by JonB
                                    #17

                                    @DeepSOIC
                                    Point taken! And interesting to know.

                                    IMHO only, this should not be done by a compiler. And this is all very Windows-specific, while Qt Creator and other Qt stuff is very much platform-independent.

                                    [I wonder whether Visual Studio even bothers to do this. I doubt the MSVC compiler does.]

                                    The bug report was rejected as "Out of Scope" for Qt, which it seems to me it indeed is. @mrjj's link or a one-liner wrapper seems to me the right way to go if you want this, and evidently it's all you can do since Qt devs are making clear they're not going to do it!

                                    D 1 Reply Last reply
                                    0
                                    • D DeepSOIC

                                      @JonB said in Computer falls asleep while Qt Creator is building a large project:

                                      to get the desired behaviour, can the OP write a one-line wrapper around the compiler or make command, or perhaps the invocation of Qt Creator itself, to call the desired SetThreadExecutionState? It seems it doesn't matter which application that comes from, so long as that application is running, so any wrapper should do it?

                                      I think it should work. Adding a wrapper for Qt Creator is a bad idea, because i do want my computer to sleep if qt creator is just sitting there doing nothing. But a wrapper around msvc or ninja or maybe even cmake will most likely work.

                                      JonBJ Online
                                      JonBJ Online
                                      JonB
                                      wrote on last edited by
                                      #18

                                      @DeepSOIC said in Computer falls asleep while Qt Creator is building a large project:

                                      Adding a wrapper for Qt Creator is a bad idea, because i do want my computer to sleep if qt creator is just sitting there doing nothing. But a wrapper around msvc or ninja or maybe even cmake will most likely work.

                                      Yes, absolutely. And in any case it's all you can do from here to get what you want :)

                                      1 Reply Last reply
                                      0
                                      • JonBJ JonB

                                        @DeepSOIC
                                        Point taken! And interesting to know.

                                        IMHO only, this should not be done by a compiler. And this is all very Windows-specific, while Qt Creator and other Qt stuff is very much platform-independent.

                                        [I wonder whether Visual Studio even bothers to do this. I doubt the MSVC compiler does.]

                                        The bug report was rejected as "Out of Scope" for Qt, which it seems to me it indeed is. @mrjj's link or a one-liner wrapper seems to me the right way to go if you want this, and evidently it's all you can do since Qt devs are making clear they're not going to do it!

                                        D Offline
                                        D Offline
                                        DeepSOIC
                                        wrote on last edited by
                                        #19

                                        @JonB said in Computer falls asleep while Qt Creator is building a large project:

                                        And this is all very Windows-specific, while Qt Creator and other Qt stuff is very much platform-independent.

                                        I don't think the issue itself is platform-specific. SetThreadExecutionState is of course windows-specific. I'm not familiar with linux, macos, chromeos, android, ios. I see some info on macos and linux here: https://stackoverflow.com/questions/31498114/how-to-programmatically-prevent-linux-computer-from-sleeping-or-turning-on-scree

                                        I don't know if the computer will sleep when building a big project with qt creator on any other platform. But I suppose it will.

                                        JonBJ 1 Reply Last reply
                                        0
                                        • D DeepSOIC

                                          @JonB said in Computer falls asleep while Qt Creator is building a large project:

                                          And this is all very Windows-specific, while Qt Creator and other Qt stuff is very much platform-independent.

                                          I don't think the issue itself is platform-specific. SetThreadExecutionState is of course windows-specific. I'm not familiar with linux, macos, chromeos, android, ios. I see some info on macos and linux here: https://stackoverflow.com/questions/31498114/how-to-programmatically-prevent-linux-computer-from-sleeping-or-turning-on-scree

                                          I don't know if the computer will sleep when building a big project with qt creator on any other platform. But I suppose it will.

                                          JonBJ Online
                                          JonBJ Online
                                          JonB
                                          wrote on last edited by
                                          #20

                                          @DeepSOIC
                                          Well, that question shows there isn't anything commonly accepted for Linux?

                                          Let's perhaps agree on the following: if the Qt library does not offer a cross-platform anti-sleep (it does not, does it?) then Qt Creator is unlikely to make such a call! Perhaps the first thing would be to lobby for such a method being available from Qt!? :)

                                          jsulmJ 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