Dag-Erling Smørgrav wrote: > Fredrik Lindberg <fli+freebsd-current_at_shapeshifter.se> writes: > >>I introduced powerd to pthreads so this is most likely my fault. > > > There is no reason to use threads in powerd. Simply merge the > devd_read() loop into your main loop, using select() with a timeout > instead of usleep(). > Wouldn't that turn in into a polling style again?. The reason to use devd was to obtain a more interrupt driven model instead of the sysctl-polling method originally used. Both metods are supported and the devd method is only used if the devd.pipe is avaiable. Obtaining the AC line state, which occurs at each iteration, requires in the devd case, only reading a variable which is very cheap. However, admittedly, I haven't studied the code for select, and it might be cheap enough. powerd can still run without pthreads (using the sysctl-method), it just needs the proper make magic. Fredrik LindbergReceived on Mon Dec 05 2005 - 18:32:16 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:48 UTC