projects
/
psensor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
17a469b
)
use pthread instead of g_thread to avoid the nightmare of glib deprecating/remoring...
author
Jean-Philippe Orsini
<jeanfi@gmail.com>
Sat, 23 Aug 2014 11:00:10 +0000
(13:00 +0200)
committer
Jean-Philippe Orsini
<jeanfi@gmail.com>
Sat, 23 Aug 2014 11:00:10 +0000
(13:00 +0200)
src/main.c
patch
|
blob
|
history
diff --git
a/src/main.c
b/src/main.c
index
db4353d
..
811893c
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-136,12
+136,14
@@
update_psensor_values_size(struct psensor **sensors, struct config *cfg)
}
}
}
}
-static void
update_measures(struct ui_psensor *ui
)
+static void
*update_measures(void *data
)
{
struct psensor **sensors;
struct config *cfg;
int period;
{
struct psensor **sensors;
struct config *cfg;
int period;
+ struct ui_psensor *ui;
+ ui = (struct ui_psensor *)data;
cfg = ui->config;
while (1) {
cfg = ui->config;
while (1) {
@@
-149,7
+151,7
@@
static void update_measures(struct ui_psensor *ui)
sensors = ui->sensors;
if (!sensors)
sensors = ui->sensors;
if (!sensors)
-
return
;
+
pthread_exit(NULL)
;
update_psensor_values_size(sensors, cfg);
update_psensor_values_size(sensors, cfg);
@@
-474,9
+476,8
@@
static struct psensor **create_sensors_list(const char *url,
int main(int argc, char **argv)
{
struct ui_psensor ui;
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;
char *url = NULL;
GApplication *app;
@@
-590,11
+591,10
@@
int main(int argc, char **argv)
ui_enable_alpha_channel(&ui);
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;
ui.graph_update_interval = ui.config->graph_update_interval;