Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Event loop thread |
| 3 | * |
| 4 | * Copyright Red Hat Inc., 2013 |
| 5 | * |
| 6 | * Authors: |
| 7 | * Stefan Hajnoczi <stefanha@redhat.com> |
| 8 | * |
| 9 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 10 | * See the COPYING file in the top-level directory. |
| 11 | * |
| 12 | */ |
| 13 | |
Peter Maydell | d38ea87 | 2016-01-29 17:50:05 +0000 | [diff] [blame] | 14 | #include "qemu/osdep.h" |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 15 | #include "qom/object.h" |
| 16 | #include "qom/object_interfaces.h" |
| 17 | #include "qemu/module.h" |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 18 | #include "block/aio.h" |
Paolo Bonzini | d16341f | 2016-10-27 12:49:00 +0200 | [diff] [blame] | 19 | #include "block/block.h" |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 20 | #include "sysemu/iothread.h" |
Stefan Hajnoczi | dc3dd0d | 2014-02-27 11:48:42 +0100 | [diff] [blame] | 21 | #include "qmp-commands.h" |
Chrysostomos Nanakos | 2f78e49 | 2014-09-18 14:30:49 +0300 | [diff] [blame] | 22 | #include "qemu/error-report.h" |
Paolo Bonzini | ab28bd2 | 2015-07-09 08:55:38 +0200 | [diff] [blame] | 23 | #include "qemu/rcu.h" |
Paolo Bonzini | e437016 | 2016-10-27 12:48:59 +0200 | [diff] [blame] | 24 | #include "qemu/main-loop.h" |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 25 | |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 26 | typedef ObjectClass IOThreadClass; |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 27 | |
| 28 | #define IOTHREAD_GET_CLASS(obj) \ |
| 29 | OBJECT_GET_CLASS(IOThreadClass, obj, TYPE_IOTHREAD) |
| 30 | #define IOTHREAD_CLASS(klass) \ |
| 31 | OBJECT_CLASS_CHECK(IOThreadClass, klass, TYPE_IOTHREAD) |
| 32 | |
Stefan Hajnoczi | cdd7abf | 2017-01-26 17:01:19 +0000 | [diff] [blame] | 33 | /* Benchmark results from 2016 on NVMe SSD drives show max polling times around |
| 34 | * 16-32 microseconds yield IOPS improvements for both iodepth=1 and iodepth=32 |
| 35 | * workloads. |
| 36 | */ |
| 37 | #define IOTHREAD_POLL_MAX_NS_DEFAULT 32768ULL |
| 38 | |
Paolo Bonzini | e437016 | 2016-10-27 12:48:59 +0200 | [diff] [blame] | 39 | static __thread IOThread *my_iothread; |
| 40 | |
| 41 | AioContext *qemu_get_current_aio_context(void) |
| 42 | { |
| 43 | return my_iothread ? my_iothread->ctx : qemu_get_aio_context(); |
| 44 | } |
| 45 | |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 46 | static void *iothread_run(void *opaque) |
| 47 | { |
| 48 | IOThread *iothread = opaque; |
| 49 | |
Paolo Bonzini | ab28bd2 | 2015-07-09 08:55:38 +0200 | [diff] [blame] | 50 | rcu_register_thread(); |
| 51 | |
Paolo Bonzini | e437016 | 2016-10-27 12:48:59 +0200 | [diff] [blame] | 52 | my_iothread = iothread; |
Stefan Hajnoczi | 88eb7c2 | 2014-02-27 11:48:41 +0100 | [diff] [blame] | 53 | qemu_mutex_lock(&iothread->init_done_lock); |
| 54 | iothread->thread_id = qemu_get_thread_id(); |
| 55 | qemu_cond_signal(&iothread->init_done_cond); |
| 56 | qemu_mutex_unlock(&iothread->init_done_lock); |
| 57 | |
Paolo Bonzini | 65c1b5b | 2016-10-27 12:49:06 +0200 | [diff] [blame] | 58 | while (!atomic_read(&iothread->stopping)) { |
| 59 | aio_poll(iothread->ctx, true); |
Wang Yong | 329163c | 2017-08-29 15:22:37 +0800 | [diff] [blame^] | 60 | |
| 61 | if (atomic_read(&iothread->worker_context)) { |
| 62 | GMainLoop *loop; |
| 63 | |
| 64 | g_main_context_push_thread_default(iothread->worker_context); |
| 65 | iothread->main_loop = |
| 66 | g_main_loop_new(iothread->worker_context, TRUE); |
| 67 | loop = iothread->main_loop; |
| 68 | |
| 69 | g_main_loop_run(iothread->main_loop); |
| 70 | iothread->main_loop = NULL; |
| 71 | g_main_loop_unref(loop); |
| 72 | |
| 73 | g_main_context_pop_thread_default(iothread->worker_context); |
| 74 | g_main_context_unref(iothread->worker_context); |
| 75 | iothread->worker_context = NULL; |
| 76 | } |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 77 | } |
Paolo Bonzini | ab28bd2 | 2015-07-09 08:55:38 +0200 | [diff] [blame] | 78 | |
| 79 | rcu_unregister_thread(); |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 80 | return NULL; |
| 81 | } |
| 82 | |
Fam Zheng | dce8921 | 2016-09-08 17:28:51 +0800 | [diff] [blame] | 83 | static int iothread_stop(Object *object, void *opaque) |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 84 | { |
Fam Zheng | dce8921 | 2016-09-08 17:28:51 +0800 | [diff] [blame] | 85 | IOThread *iothread; |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 86 | |
Fam Zheng | dce8921 | 2016-09-08 17:28:51 +0800 | [diff] [blame] | 87 | iothread = (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD); |
| 88 | if (!iothread || !iothread->ctx) { |
| 89 | return 0; |
Chrysostomos Nanakos | 2f78e49 | 2014-09-18 14:30:49 +0300 | [diff] [blame] | 90 | } |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 91 | iothread->stopping = true; |
| 92 | aio_notify(iothread->ctx); |
Wang Yong | 329163c | 2017-08-29 15:22:37 +0800 | [diff] [blame^] | 93 | if (atomic_read(&iothread->main_loop)) { |
| 94 | g_main_loop_quit(iothread->main_loop); |
| 95 | } |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 96 | qemu_thread_join(&iothread->thread); |
Fam Zheng | dce8921 | 2016-09-08 17:28:51 +0800 | [diff] [blame] | 97 | return 0; |
| 98 | } |
| 99 | |
Stefan Hajnoczi | cdd7abf | 2017-01-26 17:01:19 +0000 | [diff] [blame] | 100 | static void iothread_instance_init(Object *obj) |
| 101 | { |
| 102 | IOThread *iothread = IOTHREAD(obj); |
| 103 | |
| 104 | iothread->poll_max_ns = IOTHREAD_POLL_MAX_NS_DEFAULT; |
| 105 | } |
| 106 | |
Fam Zheng | dce8921 | 2016-09-08 17:28:51 +0800 | [diff] [blame] | 107 | static void iothread_instance_finalize(Object *obj) |
| 108 | { |
| 109 | IOThread *iothread = IOTHREAD(obj); |
| 110 | |
| 111 | iothread_stop(obj, NULL); |
Stefan Hajnoczi | 88eb7c2 | 2014-02-27 11:48:41 +0100 | [diff] [blame] | 112 | qemu_cond_destroy(&iothread->init_done_cond); |
| 113 | qemu_mutex_destroy(&iothread->init_done_lock); |
Lin Ma | eb7b5c3 | 2016-09-26 13:29:58 +0800 | [diff] [blame] | 114 | if (!iothread->ctx) { |
| 115 | return; |
| 116 | } |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 117 | aio_context_unref(iothread->ctx); |
| 118 | } |
| 119 | |
| 120 | static void iothread_complete(UserCreatable *obj, Error **errp) |
| 121 | { |
Chrysostomos Nanakos | 2f78e49 | 2014-09-18 14:30:49 +0300 | [diff] [blame] | 122 | Error *local_error = NULL; |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 123 | IOThread *iothread = IOTHREAD(obj); |
Paolo Bonzini | d21e877 | 2015-11-24 14:46:44 +0100 | [diff] [blame] | 124 | char *name, *thread_name; |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 125 | |
| 126 | iothread->stopping = false; |
Stefan Hajnoczi | 88eb7c2 | 2014-02-27 11:48:41 +0100 | [diff] [blame] | 127 | iothread->thread_id = -1; |
Chrysostomos Nanakos | 2f78e49 | 2014-09-18 14:30:49 +0300 | [diff] [blame] | 128 | iothread->ctx = aio_context_new(&local_error); |
| 129 | if (!iothread->ctx) { |
| 130 | error_propagate(errp, local_error); |
| 131 | return; |
| 132 | } |
Stefan Hajnoczi | 88eb7c2 | 2014-02-27 11:48:41 +0100 | [diff] [blame] | 133 | |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 134 | aio_context_set_poll_params(iothread->ctx, |
| 135 | iothread->poll_max_ns, |
| 136 | iothread->poll_grow, |
| 137 | iothread->poll_shrink, |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 138 | &local_error); |
| 139 | if (local_error) { |
| 140 | error_propagate(errp, local_error); |
| 141 | aio_context_unref(iothread->ctx); |
| 142 | iothread->ctx = NULL; |
| 143 | return; |
| 144 | } |
| 145 | |
Stefan Hajnoczi | 88eb7c2 | 2014-02-27 11:48:41 +0100 | [diff] [blame] | 146 | qemu_mutex_init(&iothread->init_done_lock); |
| 147 | qemu_cond_init(&iothread->init_done_cond); |
Wang Yong | 329163c | 2017-08-29 15:22:37 +0800 | [diff] [blame^] | 148 | iothread->once = (GOnce) G_ONCE_INIT; |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 149 | |
| 150 | /* This assumes we are called from a thread with useful CPU affinity for us |
| 151 | * to inherit. |
| 152 | */ |
Paolo Bonzini | d21e877 | 2015-11-24 14:46:44 +0100 | [diff] [blame] | 153 | name = object_get_canonical_path_component(OBJECT(obj)); |
| 154 | thread_name = g_strdup_printf("IO %s", name); |
| 155 | qemu_thread_create(&iothread->thread, thread_name, iothread_run, |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 156 | iothread, QEMU_THREAD_JOINABLE); |
Paolo Bonzini | d21e877 | 2015-11-24 14:46:44 +0100 | [diff] [blame] | 157 | g_free(thread_name); |
| 158 | g_free(name); |
Stefan Hajnoczi | 88eb7c2 | 2014-02-27 11:48:41 +0100 | [diff] [blame] | 159 | |
| 160 | /* Wait for initialization to complete */ |
| 161 | qemu_mutex_lock(&iothread->init_done_lock); |
| 162 | while (iothread->thread_id == -1) { |
| 163 | qemu_cond_wait(&iothread->init_done_cond, |
| 164 | &iothread->init_done_lock); |
| 165 | } |
| 166 | qemu_mutex_unlock(&iothread->init_done_lock); |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 167 | } |
| 168 | |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 169 | typedef struct { |
| 170 | const char *name; |
| 171 | ptrdiff_t offset; /* field's byte offset in IOThread struct */ |
| 172 | } PollParamInfo; |
| 173 | |
| 174 | static PollParamInfo poll_max_ns_info = { |
| 175 | "poll-max-ns", offsetof(IOThread, poll_max_ns), |
| 176 | }; |
| 177 | static PollParamInfo poll_grow_info = { |
| 178 | "poll-grow", offsetof(IOThread, poll_grow), |
| 179 | }; |
| 180 | static PollParamInfo poll_shrink_info = { |
| 181 | "poll-shrink", offsetof(IOThread, poll_shrink), |
| 182 | }; |
| 183 | |
| 184 | static void iothread_get_poll_param(Object *obj, Visitor *v, |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 185 | const char *name, void *opaque, Error **errp) |
| 186 | { |
| 187 | IOThread *iothread = IOTHREAD(obj); |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 188 | PollParamInfo *info = opaque; |
| 189 | int64_t *field = (void *)iothread + info->offset; |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 190 | |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 191 | visit_type_int64(v, name, field, errp); |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 192 | } |
| 193 | |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 194 | static void iothread_set_poll_param(Object *obj, Visitor *v, |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 195 | const char *name, void *opaque, Error **errp) |
| 196 | { |
| 197 | IOThread *iothread = IOTHREAD(obj); |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 198 | PollParamInfo *info = opaque; |
| 199 | int64_t *field = (void *)iothread + info->offset; |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 200 | Error *local_err = NULL; |
| 201 | int64_t value; |
| 202 | |
| 203 | visit_type_int64(v, name, &value, &local_err); |
| 204 | if (local_err) { |
| 205 | goto out; |
| 206 | } |
| 207 | |
| 208 | if (value < 0) { |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 209 | error_setg(&local_err, "%s value must be in range [0, %"PRId64"]", |
| 210 | info->name, INT64_MAX); |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 211 | goto out; |
| 212 | } |
| 213 | |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 214 | *field = value; |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 215 | |
| 216 | if (iothread->ctx) { |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 217 | aio_context_set_poll_params(iothread->ctx, |
| 218 | iothread->poll_max_ns, |
| 219 | iothread->poll_grow, |
| 220 | iothread->poll_shrink, |
| 221 | &local_err); |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | out: |
| 225 | error_propagate(errp, local_err); |
| 226 | } |
| 227 | |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 228 | static void iothread_class_init(ObjectClass *klass, void *class_data) |
| 229 | { |
| 230 | UserCreatableClass *ucc = USER_CREATABLE_CLASS(klass); |
| 231 | ucc->complete = iothread_complete; |
Stefan Hajnoczi | 0d9d86f | 2016-12-01 19:26:45 +0000 | [diff] [blame] | 232 | |
| 233 | object_class_property_add(klass, "poll-max-ns", "int", |
Stefan Hajnoczi | 5e5db49 | 2016-12-01 19:26:52 +0000 | [diff] [blame] | 234 | iothread_get_poll_param, |
| 235 | iothread_set_poll_param, |
| 236 | NULL, &poll_max_ns_info, &error_abort); |
| 237 | object_class_property_add(klass, "poll-grow", "int", |
| 238 | iothread_get_poll_param, |
| 239 | iothread_set_poll_param, |
| 240 | NULL, &poll_grow_info, &error_abort); |
| 241 | object_class_property_add(klass, "poll-shrink", "int", |
| 242 | iothread_get_poll_param, |
| 243 | iothread_set_poll_param, |
| 244 | NULL, &poll_shrink_info, &error_abort); |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | static const TypeInfo iothread_info = { |
| 248 | .name = TYPE_IOTHREAD, |
| 249 | .parent = TYPE_OBJECT, |
| 250 | .class_init = iothread_class_init, |
| 251 | .instance_size = sizeof(IOThread), |
Stefan Hajnoczi | cdd7abf | 2017-01-26 17:01:19 +0000 | [diff] [blame] | 252 | .instance_init = iothread_instance_init, |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 253 | .instance_finalize = iothread_instance_finalize, |
| 254 | .interfaces = (InterfaceInfo[]) { |
| 255 | {TYPE_USER_CREATABLE}, |
| 256 | {} |
| 257 | }, |
| 258 | }; |
| 259 | |
| 260 | static void iothread_register_types(void) |
| 261 | { |
| 262 | type_register_static(&iothread_info); |
| 263 | } |
| 264 | |
| 265 | type_init(iothread_register_types) |
| 266 | |
Stefan Hajnoczi | be8d853 | 2014-03-03 11:30:05 +0100 | [diff] [blame] | 267 | char *iothread_get_id(IOThread *iothread) |
| 268 | { |
| 269 | return object_get_canonical_path_component(OBJECT(iothread)); |
| 270 | } |
| 271 | |
| 272 | AioContext *iothread_get_aio_context(IOThread *iothread) |
| 273 | { |
| 274 | return iothread->ctx; |
| 275 | } |
Stefan Hajnoczi | dc3dd0d | 2014-02-27 11:48:42 +0100 | [diff] [blame] | 276 | |
| 277 | static int query_one_iothread(Object *object, void *opaque) |
| 278 | { |
| 279 | IOThreadInfoList ***prev = opaque; |
| 280 | IOThreadInfoList *elem; |
| 281 | IOThreadInfo *info; |
| 282 | IOThread *iothread; |
| 283 | |
| 284 | iothread = (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD); |
| 285 | if (!iothread) { |
| 286 | return 0; |
| 287 | } |
| 288 | |
| 289 | info = g_new0(IOThreadInfo, 1); |
| 290 | info->id = iothread_get_id(iothread); |
| 291 | info->thread_id = iothread->thread_id; |
Pavel Hrdina | 5fc0048 | 2017-02-10 10:41:17 +0100 | [diff] [blame] | 292 | info->poll_max_ns = iothread->poll_max_ns; |
| 293 | info->poll_grow = iothread->poll_grow; |
| 294 | info->poll_shrink = iothread->poll_shrink; |
Stefan Hajnoczi | dc3dd0d | 2014-02-27 11:48:42 +0100 | [diff] [blame] | 295 | |
| 296 | elem = g_new0(IOThreadInfoList, 1); |
| 297 | elem->value = info; |
| 298 | elem->next = NULL; |
| 299 | |
| 300 | **prev = elem; |
| 301 | *prev = &elem->next; |
| 302 | return 0; |
| 303 | } |
| 304 | |
| 305 | IOThreadInfoList *qmp_query_iothreads(Error **errp) |
| 306 | { |
| 307 | IOThreadInfoList *head = NULL; |
| 308 | IOThreadInfoList **prev = &head; |
Daniel P. Berrange | bc2256c | 2015-05-13 17:14:05 +0100 | [diff] [blame] | 309 | Object *container = object_get_objects_root(); |
Stefan Hajnoczi | dc3dd0d | 2014-02-27 11:48:42 +0100 | [diff] [blame] | 310 | |
| 311 | object_child_foreach(container, query_one_iothread, &prev); |
| 312 | return head; |
| 313 | } |
Fam Zheng | dce8921 | 2016-09-08 17:28:51 +0800 | [diff] [blame] | 314 | |
| 315 | void iothread_stop_all(void) |
| 316 | { |
| 317 | Object *container = object_get_objects_root(); |
Paolo Bonzini | d16341f | 2016-10-27 12:49:00 +0200 | [diff] [blame] | 318 | BlockDriverState *bs; |
| 319 | BdrvNextIterator it; |
| 320 | |
| 321 | for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) { |
| 322 | AioContext *ctx = bdrv_get_aio_context(bs); |
| 323 | if (ctx == qemu_get_aio_context()) { |
| 324 | continue; |
| 325 | } |
| 326 | aio_context_acquire(ctx); |
| 327 | bdrv_set_aio_context(bs, qemu_get_aio_context()); |
| 328 | aio_context_release(ctx); |
| 329 | } |
Fam Zheng | dce8921 | 2016-09-08 17:28:51 +0800 | [diff] [blame] | 330 | |
| 331 | object_child_foreach(container, iothread_stop, NULL); |
| 332 | } |
Wang Yong | 329163c | 2017-08-29 15:22:37 +0800 | [diff] [blame^] | 333 | |
| 334 | static gpointer iothread_g_main_context_init(gpointer opaque) |
| 335 | { |
| 336 | AioContext *ctx; |
| 337 | IOThread *iothread = opaque; |
| 338 | GSource *source; |
| 339 | |
| 340 | iothread->worker_context = g_main_context_new(); |
| 341 | |
| 342 | ctx = iothread_get_aio_context(iothread); |
| 343 | source = aio_get_g_source(ctx); |
| 344 | g_source_attach(source, iothread->worker_context); |
| 345 | g_source_unref(source); |
| 346 | |
| 347 | aio_notify(iothread->ctx); |
| 348 | return NULL; |
| 349 | } |
| 350 | |
| 351 | GMainContext *iothread_get_g_main_context(IOThread *iothread) |
| 352 | { |
| 353 | g_once(&iothread->once, iothread_g_main_context_init, iothread); |
| 354 | |
| 355 | return iothread->worker_context; |
| 356 | } |