Changeset 427 for vendor/current/source3/lib/events.c
- Timestamp:
- Apr 9, 2010, 3:20:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/events.c
r414 r427 106 106 if ((ev->timer_events != NULL) 107 107 && (timeval_compare(&now, &ev->timer_events->next_event) >= 0)) { 108 /* this older events system did not auto-free timed 109 events on running them, and had a race condition 110 where the event could be called twice if the 111 talloc_free of the te happened after the callback 112 made a call which invoked the event loop. To avoid 113 this while still allowing old code which frees the 114 te, we need to create a temporary context which 115 will be used to ensure the te is freed. We also 116 remove the te from the timed event list before we 117 call the handler, to ensure we can't loop */ 118 119 struct tevent_timer *te = ev->timer_events; 120 TALLOC_CTX *tmp_ctx = talloc_new(ev); 108 121 109 122 DEBUG(10, ("Running timed event \"%s\" %p\n", 110 123 ev->timer_events->handler_name, ev->timer_events)); 111 124 112 ev->timer_events->handler(ev, ev->timer_events, now, 113 ev->timer_events->private_data); 125 DLIST_REMOVE(ev->timer_events, te); 126 talloc_steal(tmp_ctx, te); 127 128 te->handler(ev, te, now, te->private_data); 129 130 talloc_free(tmp_ctx); 114 131 return true; 115 132 }
Note:
See TracChangeset
for help on using the changeset viewer.