}
}
-static void update_measures(struct ui_psensor *ui)
+static void *update_measures(void *data)
{
struct psensor **sensors;
struct config *cfg;
int period;
+ struct ui_psensor *ui;
+ ui = (struct ui_psensor *)data;
cfg = ui->config;
while (1) {
sensors = ui->sensors;
if (!sensors)
- return;
+ pthread_exit(NULL);
update_psensor_values_size(sensors, cfg);
/* number of uniq colors */
#define COLORS_COUNT 8
- unsigned int colors[COLORS_COUNT][3] = {
- {0x0000, 0x0000, 0x0000}, /* black */
- {0xffff, 0x0000, 0x0000}, /* red */
- {0x0000, 0x0000, 0xffff}, /* blue */
- {0x0000, 0xffff, 0x0000}, /* green */
+ double colors[COLORS_COUNT][3] = {
+ {0, 0, 0}, /* black */
+ {1, 0, 0}, /* red */
+ {0, 0, 1}, /* blue */
+ {0, 1, 0}, /* green */
- {0x7fff, 0x7fff, 0x7fff}, /* grey */
- {0x7fff, 0x0000, 0x0000}, /* dark red */
- {0x0000, 0x0000, 0x7fff}, /* dark blue */
- {0x0000, 0x7fff, 0x0000} /* dark green */
+ {0.5, 0.5, 0.5},/* grey */
+ {0.5, 0, 0}, /* dark red */
+ {0, 0, 0.5}, /* dark blue */
+ {0, 0.5, 0} /* dark green */
};
struct psensor **cur;
int i;
s->alarm_low_threshold
= config_get_sensor_alarm_low_threshold(s->id);
- if (is_temp_type(s->type) || is_fan_type(s->type)) {
- s->alarm_enabled
+ s->alarm_enabled
= config_get_sensor_alarm_enabled(s->id);
- } else {
- s->alarm_high_threshold = 0;
- s->alarm_enabled = 0;
- }
sensor_cur++;
}
int main(int argc, char **argv)
{
struct ui_psensor ui;
- GError *error;
- GThread *thread;
- int optc, cmdok, opti, use_libatasmart, new_instance;
+ pthread_t thread;
+ int optc, cmdok, opti, use_libatasmart, new_instance, ret;
char *url = NULL;
GApplication *app;
ui_enable_alpha_channel(&ui);
- thread = g_thread_create((GThreadFunc) update_measures,
- &ui, TRUE, &error);
+ ret = pthread_create(&thread, NULL, update_measures, &ui);
- if (!thread)
- g_error_free(error);
+ if (ret)
+ log_err(_("Failed to create thread for monitoring sensors"));
ui.graph_update_interval = ui.config->graph_update_interval;