On Mon, Dec 22, 2014 at 13:56, David Gwynne wrote:
> i keep writing code that uses this, cos i was sure i added it years
> ago. turns out i havent.
>
> this is like TASK_INITIALIZER or the queue _INTIIALIZER macros. it
> lets you init a declaration of a timeout.
seems pretty obvious. timeout_set
ags & TIMEOUT_INITIALIZED)
#define timeout_triggered(to) ((to)->to_flags & TIMEOUT_TRIGGERED)
+#define TIMEOUT_INITIALIZER(_f, _a) \
+ { { NULL, NULL }, (_f), (_a), 0, TIMEOUT_INITIALIZED }
+
struct bintime;
void timeout_set(struct timeout *, void (*)(void *), void *);
Index: share/ma
> On Mon, Dec 09, 2013 at 01:55:53PM +1000, David Gwynne wrote:
> > this is a demonstration of using TIMEOUT_INITIALIZED().
> >
> > because we know the timeout is always set up correctly, we dont
> > have to test for it all over the place.
> >
>
> [a bit of snipping...]
>
> > - if (timeout_in
On Mon, Dec 09, 2013 at 10:18:06PM +1000, David Gwynne wrote:
>
> On 9 Dec 2013, at 10:01 pm, David Gwynne wrote:
>
> >
> > On 9 Dec 2013, at 6:59 pm, Bret Lambert wrote:
> >
> >> On Mon, Dec 09, 2013 at 01:55:53PM +1000, David Gwynne wrote:
> >>> this is a demonstration of using TIMEOUT_INIT
On 9 Dec 2013, at 10:01 pm, David Gwynne wrote:
>
> On 9 Dec 2013, at 6:59 pm, Bret Lambert wrote:
>
>> On Mon, Dec 09, 2013 at 01:55:53PM +1000, David Gwynne wrote:
>>> this is a demonstration of using TIMEOUT_INITIALIZED().
>>>
>>> because we know the timeout is always set up correctly, we
On 9 Dec 2013, at 6:59 pm, Bret Lambert wrote:
> On Mon, Dec 09, 2013 at 01:55:53PM +1000, David Gwynne wrote:
>> this is a demonstration of using TIMEOUT_INITIALIZED().
>>
>> because we know the timeout is always set up correctly, we dont
>> have to test for it all over the place.
>>
>
> [a
On Mon, Dec 09, 2013 at 01:55:53PM +1000, David Gwynne wrote:
> this is a demonstration of using TIMEOUT_INITIALIZED().
>
> because we know the timeout is always set up correctly, we dont
> have to test for it all over the place.
>
[a bit of snipping...]
> - if (timeout_initialized(&rnd_tim
= rnd_event_space;
struct rand_event *rnd_event_tail = rnd_event_space;
-struct timeout rnd_timeout;
+struct timeout rnd_timeout = TIMEOUT_INITIALIZER(dequeue_randomness, NULL);
struct rndstats rndstats;
u_int32_t entropy_pool[POOLWORDS];
u_int entropy_add_ptr;
u_char entropy_input_rotate;
-void
-r1.24 timeout.h
--- sys/sys/timeout.h 27 Nov 2013 04:28:32 - 1.24
+++ sys/sys/timeout.h 9 Dec 2013 03:51:22 -
@@ -64,6 +64,9 @@ struct timeout {
int to_flags; /* misc flags */
};
+#define TIMEOUT_INITIALIZER(_f, _a) \
+ { { NULL, NULL }, (_f