Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
timeout.c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
timeout.c
Commits
df1d1855
Commit
df1d1855
authored
May 27, 2013
by
William Ahern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync refactoring work
parent
f301bdf3
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
279 additions
and
151 deletions
+279
-151
Makefile
Makefile
+4
-1
timer.c
timer.c
+229
-149
timer.h
timer.h
+46
-1
No files found.
Makefile
View file @
df1d1855
all
:
timer
CPPFLAGS
=
-DTIMER_DEBUG
-DTIMER_MAIN
WHEEL_BIT
=
6
WHEEL_NUM
=
4
CPPFLAGS
=
-DTIMER_DEBUG
-DTIMER_MAIN
-DWHEEL_BIT
=
$(WHEEL_BIT)
-DWHEEL_NUM
=
$(WHEEL_NUM)
CFLAGS
=
-O2
-g
-Wall
-Wextra
...
...
timer.c
View file @
df1d1855
This diff is collapsed.
Click to expand it.
timer.h
View file @
df1d1855
...
...
@@ -26,7 +26,8 @@
#ifndef TIMER_H
#define TIMER_H
#include <stdint.h>
/* uint64_t */
#include <stdbool.h>
/* bool */
#include <inttypes.h>
/* PRIu64 PRIx64 PRIX64 uint64_t */
/*
...
...
@@ -34,7 +35,51 @@
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#define TIMER_mHZ TIMER_C(1000)
#define TIMER_uHZ TIMER_C(1000000)
#define TIMER_nHZ TIMER_C(1000000000)
#define TIMER_C(n) UINT64_C(n)
#define TIMER_PRIu PRIu64
#define TIMER_PRIx PRIx64
#define TIMER_PRIX PRIX64
#define TIMEOUT_C(n) TIMER_C(n)
#define TIMEOUT_PRIu TIMER_PRIu
#define TIMEOUT_PRIx TIMER_PRIx
#define TIMEOUT_PRIX TIMER_PRIX
typedef
uint64_t
timer_t
;
/* absolute times */
typedef
timer_t
timeout_t
;
/* relative times */
struct
timer
;
struct
timeout
;
void
timer_add
(
struct
timer
*
,
struct
timeout
*
,
timeout_t
);
void
timer_del
(
struct
timer
*
,
struct
timeout
*
);
bool
timer_pending
(
struct
timer
*
);
timeout_t
timer_timeout
(
struct
timer
*
);
/*
* T I M E O U T C O N T E X T I N T E R F A C E S
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#define TIMEOUT_PERIODIC 0x01
struct
timeout
*
timeout_init
(
struct
timeout
*
,
int
);
bool
timeout_pending
(
struct
timeout
*
);
/* true if pending in a timing wheel or on expired queue, false otherwise */
bool
timeout_expired
(
struct
timeout
*
);
/* true if currently or previously on expired queue, false otherwise */
#endif
/* TIMER_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment