I'm curious if there's any significance in number 0.63739 in this implementation double is_computer_on_fire(void) { return 0.63739; } https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181...
How to programmatically find out if computer is on
121–130 of 197 posts
Re: How to programmatically find out if computer is on
#122Earlier quoted context omitted.
There's a syscall to check whether the computer is on so just call that before this and you'll be fine
That introduces a time-of-check to time-of-use bug ( https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use ).
Re: How to programmatically find out if computer is on
#123Presumably there's a non-joke version of this at some level in the hardware / firmware stack?
Re: How to programmatically find out if computer is on
#124Asynchronous JavaScript browser DOM callback API:
Asynchronous is definitely the way to go. I once tried synchronous code. Had to move it to a service worker so as to not bog down the UI, and you don't even want to know what service workers do when the computer is off. Let's just say it's undocumented.
Re: How to programmatically find out if computer is on
#125Re: How to programmatically find out if computer is on
#126I have recently wondered if there is a way to guarantee that a processor is idling. By this I mean, is there a way to ensure another computer has been idle for a time when it promises that it has been. Kind of the opposite of a crypto mining problem.
Re: How to programmatically find out if computer is on
#127Re: How to programmatically find out if computer is on
#128Earlier 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
#129> Returns the temperature of the motherboard if the computer is currently on fire. Smoldering doesn't count. If the computer isn't on fire, the function returns some other value.
Re: How to programmatically find out if computer is on
#130While this is a joke, there are some contexts in which it does make sense to ask whether the computer is on. For instance, most laptops have an embedded controller which runs all the time, even when the laptop is powered off, and manages things like battery charging and the power state. Within that embedded controller, an is_computer_on() function could legitimately return "false".
I've often wondered why WOL is so poorly designed. WOL should be a function of the NIC, completely independent of the OS and capable of returning status codes even if the computer is "off".
I've been using this for years to wake hosts at home when I'm abroad. It's invaluable.