Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
35f329e0
Commit
35f329e0
authored
7 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
sys/xtimer: add xtimer_set_timeout_flag()
parent
1bb256a3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sys/include/xtimer.h
+11
-0
11 additions, 0 deletions
sys/include/xtimer.h
sys/xtimer/xtimer.c
+19
-0
19 additions, 0 deletions
sys/xtimer/xtimer.c
with
30 additions
and
0 deletions
sys/include/xtimer.h
+
11
−
0
View file @
35f329e0
...
@@ -439,6 +439,17 @@ static inline bool xtimer_less64(xtimer_ticks64_t a, xtimer_ticks64_t b);
...
@@ -439,6 +439,17 @@ static inline bool xtimer_less64(xtimer_ticks64_t a, xtimer_ticks64_t b);
*/
*/
int
xtimer_mutex_lock_timeout
(
mutex_t
*
mutex
,
uint64_t
us
);
int
xtimer_mutex_lock_timeout
(
mutex_t
*
mutex
,
uint64_t
us
);
/**
* @brief Set timeout thread flag after @p timeout
*
* This function will set THREAD_FLAG_TIMEOUT on the current thread after @p
* timeout usec have passed.
*
* @param[in] t timer struct to use
* @param[in] timeout timeout in usec
*/
void
xtimer_set_timeout_flag
(
xtimer_t
*
t
,
uint32_t
timeout
);
/**
/**
* @brief xtimer backoff value
* @brief xtimer backoff value
*
*
...
...
This diff is collapsed.
Click to expand it.
sys/xtimer/xtimer.c
+
19
−
0
View file @
35f329e0
...
@@ -30,6 +30,10 @@
...
@@ -30,6 +30,10 @@
#include
"timex.h"
#include
"timex.h"
#ifdef MODULE_CORE_THREAD_FLAGS
#include
"thread_flags.h"
#endif
#define ENABLE_DEBUG 0
#define ENABLE_DEBUG 0
#include
"debug.h"
#include
"debug.h"
...
@@ -257,3 +261,18 @@ int xtimer_mutex_lock_timeout(mutex_t *mutex, uint64_t timeout)
...
@@ -257,3 +261,18 @@ int xtimer_mutex_lock_timeout(mutex_t *mutex, uint64_t timeout)
xtimer_remove
(
&
t
);
xtimer_remove
(
&
t
);
return
-
mt
.
timeout
;
return
-
mt
.
timeout
;
}
}
#ifdef MODULE_CORE_THREAD_FLAGS
static
void
_set_timeout_flag_callback
(
void
*
arg
)
{
thread_flags_set
(
arg
,
THREAD_FLAG_TIMEOUT
);
}
void
xtimer_set_timeout_flag
(
xtimer_t
*
t
,
uint32_t
timeout
)
{
t
->
callback
=
_set_timeout_flag_callback
;
t
->
arg
=
(
thread_t
*
)
sched_active_thread
;
thread_flags_clear
(
THREAD_FLAG_TIMEOUT
);
xtimer_set
(
t
,
timeout
);
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment