2 //gcc -o efl_thread_1 efl_thread_win32_1.c -g `pkg-config --cflags --libs elementary`
3 #include <Elementary.h>
4 #define WIN32_LEAN_AND_MEAN
7 static Evas_Object *win = NULL;
8 static Evas_Object *rect = NULL;
12 // BEGIN - code running in my custom win32 thread instance
15 my_thread_run(LPVOID arg)
21 ecore_thread_main_loop_begin(); // begin critical
22 { // indented for illustration of "critical" block
25 x = 200 + (200 * sin(t));
26 y = 200 + (200 * cos(t));
27 evas_object_move(rect, x - 50, y - 50);
29 ecore_thread_main_loop_end(); // end critical
36 // END - code running in my custom win32 thread instance
41 thread = CreateThread(NULL, 0, my_thread_run, NULL, 0, NULL);
44 char *str = evil_last_error_get();
47 fprintf("thread creation failed: %s\n", str);
54 elm_main(int argc, char **argv)
58 win = elm_win_add(NULL, "efl-thread-1", ELM_WIN_BASIC);
59 elm_win_title_set(win, "EFL Thread 1");
60 elm_win_autodel_set(win, EINA_TRUE);
61 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
62 evas_object_resize(win, 400, 400);
63 evas_object_show(win);
66 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
67 elm_win_resize_object_add(win, bg);
70 o = evas_object_rectangle_add(evas_object_evas_get(win));
71 evas_object_color_set(o, 50, 80, 180, 255);
72 evas_object_resize(o, 100, 100);
76 // create custom thread to do some "work on the side"