Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/8] fakesys: fix ev_is_active not working on fake timers
Date: Tue, 15 Dec 2020 12:42:44 +0300	[thread overview]
Message-ID: <48a4baa9-3b76-15d4-3c3f-a7458b0821e6@tarantool.org> (raw)
In-Reply-To: <641666dad7ac4c633b173800f2dc49438098caae.1607879643.git.v.shpilevoy@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

  reply	other threads:[~2020-12-15  9:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-13 17:15 [Tarantool-patches] [PATCH 0/8] Raft module, part 4 - unit tests Vladislav Shpilevoy
2020-12-13 17:15 ` [Tarantool-patches] [PATCH 1/8] fakesys: fix ev_is_active not working on fake timers Vladislav Shpilevoy
2020-12-15  9:42   ` Serge Petrenko [this message]
2020-12-13 17:15 ` [Tarantool-patches] [PATCH 2/8] fakesys: introduce fakeev_timer_remaining() Vladislav Shpilevoy
2020-12-15  9:43   ` Serge Petrenko
2020-12-13 17:15 ` [Tarantool-patches] [PATCH 3/8] raft: introduce raft_ev Vladislav Shpilevoy
2020-12-15 10:02   ` Serge Petrenko
2020-12-13 17:15 ` [Tarantool-patches] [PATCH 4/8] test: introduce raft unit tests Vladislav Shpilevoy
2020-12-13 18:10   ` Vladislav Shpilevoy
2020-12-16 13:03   ` Serge Petrenko
2020-12-17 22:44     ` Vladislav Shpilevoy
2020-12-18  8:17       ` Serge Petrenko
2020-12-20 17:28         ` Vladislav Shpilevoy
2020-12-21  7:36           ` Serge Petrenko
2020-12-13 17:15 ` [Tarantool-patches] [PATCH 5/8] raft: fix crash when received 0 term message Vladislav Shpilevoy
2020-12-16 13:05   ` Serge Petrenko
2020-12-13 17:15 ` [Tarantool-patches] [PATCH 6/8] raft: fix ignorance of bad state receipt Vladislav Shpilevoy
2020-12-16 13:06   ` Serge Petrenko
2020-12-13 17:15 ` [Tarantool-patches] [PATCH 7/8] raft: fix crash on election timeout decrease Vladislav Shpilevoy
2020-12-16 13:08   ` Serge Petrenko
2020-12-13 17:15 ` [Tarantool-patches] [PATCH 8/8] raft: fix crash on death " Vladislav Shpilevoy
2020-12-16 13:10   ` Serge Petrenko
2020-12-21 16:50 ` [Tarantool-patches] [PATCH 0/8] Raft module, part 4 - unit tests Vladislav Shpilevoy
2020-12-21 17:29 ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48a4baa9-3b76-15d4-3c3f-a7458b0821e6@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/8] fakesys: fix ev_is_active not working on fake timers' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox