1 #include <Elementary.h>
4 static Evas_Object *win = NULL;
5 static Evas_Object *rect = NULL;
7 static pthread_t thread_id;
9 // BEGIN - code running in my custom pthread instance
12 my_thread_run(void *arg)
18 ecore_thread_main_loop_begin(); // begin critical
19 { // indented for illustration of "critical" block
22 x = 200 + (200 * sin(t));
23 y = 200 + (200 * cos(t));
24 evas_object_move(rect, x - 50, y - 50);
26 ecore_thread_main_loop_end(); // end critical
33 // END - code running in my custom pthread instance
40 if (pthread_attr_init(&attr) != 0)
41 perror("pthread_attr_init");
42 if (pthread_create(&thread_id, &attr, my_thread_run, NULL) != 0)
43 perror("pthread_create");
47 elm_main(int argc, char **argv)
51 win = elm_win_add(NULL, "efl-thread-1", ELM_WIN_BASIC);
52 elm_win_title_set(win, "EFL Thread 1");
53 evas_object_resize(win, 400, 400);
54 evas_object_show(win);
57 elm_win_resize_object_add(win, bg);
58 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61 o = evas_object_rectangle_add(evas_object_evas_get(win));
62 evas_object_color_set(o, 50, 80, 180, 255);
63 evas_object_resize(o, 100, 100);
67 // create custom thread to do some "work on the side"