How to programmatically find out if computer is on
31–40 of 197 posts
Re: How to programmatically find out if computer is on
#32Javascript equivalent function is kind of wonky so they had to make is_the_computer_really_on() to do what you want here.
Re: How to programmatically find out if computer is on
#33is_computer_on_fire() seems more usable...
weird how it's returning a constant https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181... Interesting it seems to come from BeOS: https://github.com/haiku/haiku/commit/bcf475ec65f1060c0a8abf... where the same function had a hn thread about it already a couple years ago :D https://news.ycombinator.com/item?id=8780606
Re: How to programmatically find out if computer is on
#34Where does the code run when the computer is off? Edit: I see the downvotes, yet i still don't know if it's a joke. I was genuinely asking the question.
Re: How to programmatically find out if computer is on
#35 Re: How to programmatically find out if computer is on
#36 // power cycle computer
bool was_on = set_computer_on(true); // returns prior value
if (was_on) {
set_computer_on(false);
set_computer_on(true);
} else {
// was previously off, is now on: nothing to do!
}Re: How to programmatically find out if computer is on
#37is_computer_on_fire() seems more usable...
weird how it's returning a constant https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181... Interesting it seems to come from BeOS: https://github.com/haiku/haiku/commit/bcf475ec65f1060c0a8abf... where the same function had a hn thread about it already a couple years ago :D https://news.ycombinator.com/item?id=8780606
Probably I'm being nerd sniped. https://xkcd.com/356/
Re: How to programmatically find out if computer is on
#38Re: How to programmatically find out if computer is on
#39Earlier quoted context omitted.
Hmm, it seems like you need to make sure the computer is on before calling this function, or else you run the risk of getting back undefined data. Seems like we also need a function that can be used to tell if the computer is on...
Nah. Just bump that responsibility to the caller, and power supply manufacturer. Have the caller call power_on_computer() first always. This will ensure you always get defined state! ...What do you mean not every power supply manufacturer implements the power_on_computer() function as a NOOP if the computer is already on?!
Re: How to programmatically find out if computer is on
#40Where does the code run when the computer is off? Edit: I see the downvotes, yet i still don't know if it's a joke. I was genuinely asking the question.