From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B352845C304 for ; Tue, 15 Dec 2020 12:42:45 +0300 (MSK) References: <641666dad7ac4c633b173800f2dc49438098caae.1607879643.git.v.shpilevoy@tarantool.org> From: Serge Petrenko Message-ID: <48a4baa9-3b76-15d4-3c3f-a7458b0821e6@tarantool.org> Date: Tue, 15 Dec 2020 12:42:44 +0300 MIME-Version: 1.0 In-Reply-To: <641666dad7ac4c633b173800f2dc49438098caae.1607879643.git.v.shpilevoy@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [Tarantool-patches] [PATCH 1/8] fakesys: fix ev_is_active not working on fake timers List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org 13.12.2020 20:15, Vladislav Shpilevoy пишет: > fakeev timers didn't set 'active' flag for ev_watcher objects. > > Because of that if fakeev_timer_start() was called, the timer > wasn't visible as 'active' via libev API. > > Fakeev is supposed to be a drop-in simulation of libev, so it > should "work" exactly the same. > --- > src/lib/fakesys/fakeev.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/lib/fakesys/fakeev.c b/src/lib/fakesys/fakeev.c > index 20fab916b..8273c7ca8 100644 > --- a/src/lib/fakesys/fakeev.c > +++ b/src/lib/fakesys/fakeev.c > @@ -181,6 +181,8 @@ fakeev_timer_event_delete(struct fakeev_event *e) > { > assert(e->type == FAKEEV_EVENT_TIMER); > struct fakeev_timer_event *te = (struct fakeev_timer_event *)e; > + assert(te->watcher->active == 1); > + te->watcher->active = 0; > mh_int_t rc = mh_i64ptr_find(events_hash, (uint64_t) te->watcher, NULL); > assert(rc != mh_end(events_hash)); > mh_i64ptr_del(events_hash, rc, NULL); > @@ -209,6 +211,8 @@ fakeev_timer_event_process(struct fakeev_event *e, struct ev_loop *loop) > static void > fakeev_timer_event_new(struct ev_watcher *watcher, double delay) > { > + assert(watcher->active == 0); > + watcher->active = 1; > struct fakeev_timer_event *e = malloc(sizeof(*e)); > assert(e != NULL); > fakeev_event_create(&e->base, FAKEEV_EVENT_TIMER, delay, Hi! Thanks for the patch! LGTM. -- Serge Petrenko