| 73 event->callback(&event->event, event->userdata); |
73 event->callback(&event->event, event->userdata); |
| 74 } |
74 } |
| 75 } |
75 } |
| 76 ui_queue_free(event_queue); |
76 ui_queue_free(event_queue); |
| 77 } |
77 } |
| |
78 |
| |
79 typedef struct CallMain { |
| |
80 UiServerEvent event; |
| |
81 ui_threadfunc func; |
| |
82 void *data; |
| |
83 } CallMain; |
| |
84 |
| |
85 static void mainthr(UiServerEventData *event, void *userdata) { |
| |
86 CallMain *c = userdata; |
| |
87 if(c->func) { |
| |
88 c->func(c->data); |
| |
89 } |
| |
90 free(c); |
| |
91 } |
| |
92 |
| |
93 void ui_call_mainthread(ui_threadfunc tf, void* td) { |
| |
94 CallMain *c = malloc(sizeof(CallMain)); |
| |
95 c->func = tf; |
| |
96 c->data = td; |
| |
97 ui_queue_put(event_queue, c); |
| |
98 } |