Changeset 988 for vendor/current/lib/tevent/tevent.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/tevent/tevent.c
r740 r988 113 113 static void tevent_backend_init(void) 114 114 { 115 static bool done; 116 117 if (done) { 118 return; 119 } 120 121 done = true; 122 115 123 tevent_select_init(); 116 124 tevent_poll_init(); 125 tevent_poll_mt_init(); 126 #if defined(HAVE_EPOLL) 127 tevent_epoll_init(); 128 #elif defined(HAVE_SOLARIS_PORTS) 129 tevent_port_init(); 130 #endif 131 117 132 tevent_standard_init(); 118 #ifdef HAVE_EPOLL 119 tevent_epoll_init(); 120 #endif 133 } 134 135 _PRIVATE_ const struct tevent_ops *tevent_find_ops_byname(const char *name) 136 { 137 struct tevent_ops_list *e; 138 139 tevent_backend_init(); 140 141 if (name == NULL) { 142 name = tevent_default_backend; 143 } 144 if (name == NULL) { 145 name = "standard"; 146 } 147 148 for (e = tevent_backends; e != NULL; e = e->next) { 149 if (0 == strcmp(e->name, name)) { 150 return e->ops; 151 } 152 } 153 154 return NULL; 121 155 } 122 156 … … 160 194 } 161 195 196 ev->last_zero_timer = NULL; 162 197 for (te = ev->timer_events; te; te = tn) { 163 198 tn = te->next; … … 186 221 } 187 222 223 /* removing nesting hook or we get an abort when nesting is 224 * not allowed. -- SSS 225 * Note that we need to leave the allowed flag at its current 226 * value, otherwise the use in tevent_re_initialise() will 227 * leave the event context with allowed forced to false, which 228 * will break users that expect nesting to be allowed 229 */ 230 ev->nesting.level = 0; 231 ev->nesting.hook_fn = NULL; 232 ev->nesting.hook_private = NULL; 233 188 234 return 0; 189 235 } … … 200 246 NOTE: use tevent_context_init() inside of samba! 201 247 */ 202 static struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx, 203 const struct tevent_ops *ops) 248 struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx, 249 const struct tevent_ops *ops, 250 void *additional_data) 204 251 { 205 252 struct tevent_context *ev; … … 212 259 213 260 ev->ops = ops; 261 ev->additional_data = additional_data; 214 262 215 263 ret = ev->ops->context_init(ev); … … 230 278 const char *name) 231 279 { 232 struct tevent_ops_list *e; 233 234 tevent_backend_init(); 235 236 if (name == NULL) { 237 name = tevent_default_backend; 238 } 239 if (name == NULL) { 240 name = "standard"; 241 } 242 243 for (e=tevent_backends;e;e=e->next) { 244 if (strcmp(name, e->name) == 0) { 245 return tevent_context_init_ops(mem_ctx, e->ops); 246 } 247 } 248 return NULL; 280 const struct tevent_ops *ops; 281 282 ops = tevent_find_ops_byname(name); 283 if (ops == NULL) { 284 return NULL; 285 } 286 287 return tevent_context_init_ops(mem_ctx, ops, NULL); 249 288 } 250 289 … … 392 431 /* 393 432 schedule an immediate event 394 return NULL on failure395 433 */ 396 434 void _tevent_schedule_immediate(struct tevent_immediate *im, … … 492 530 } 493 531 532 tevent_trace_point_callback(ev, TEVENT_TRACE_BEFORE_LOOP_ONCE); 494 533 ret = ev->ops->loop_once(ev, location); 534 tevent_trace_point_callback(ev, TEVENT_TRACE_AFTER_LOOP_ONCE); 495 535 496 536 if (ev->nesting.level > 0) { … … 552 592 553 593 while (!finished(private_data)) { 594 tevent_trace_point_callback(ev, TEVENT_TRACE_BEFORE_LOOP_ONCE); 554 595 ret = ev->ops->loop_once(ev, location); 596 tevent_trace_point_callback(ev, TEVENT_TRACE_AFTER_LOOP_ONCE); 555 597 if (ret != 0) { 556 598 break;
Note:
See TracChangeset
for help on using the changeset viewer.