Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys: xtimer: add xtimer_set_timeout_flag() #7558

Merged
merged 2 commits into from
Sep 5, 2017

Conversation

kaspar030
Copy link
Contributor

This PR adds an xtimer convenience function to set the timeout flag after a certain period.

This intentionally does not allow to set any flag (only THREAD_FLAG_TIMEOUT), or set a flag on any thread (not the calling one), for simplicity and performance reasons.

The thread_flags test is updated with a simple test of the new function.

@kaspar030 kaspar030 added Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Sep 1, 2017
@kaspar030 kaspar030 added this to the Release 2017.10 milestone Sep 1, 2017
@kaspar030 kaspar030 requested a review from jnohlgard September 1, 2017 21:59
@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. labels Sep 1, 2017
Copy link
Member

@jnohlgard jnohlgard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to xtimer look sane.
I think that the unittests dependencies need updating. However, is it OK for a core feature test to depend on a sys module?

@kaspar030 kaspar030 force-pushed the add_xtimer_set_timeout_flag branch from 1326a56 to d8cf251 Compare September 2, 2017 20:46
@kaspar030
Copy link
Contributor Author

I think that the unittests dependencies need updating. However, is it OK for a core feature test to
depend on a sys module?

Which unittests do you mean? Thread flags don't have unittests (yet). The deps of tests/thread_flags are updated with the xtimer dependency.

@jnohlgard
Copy link
Member

Re unit tests: I must have misread when I looked at the diff before.
Tested working on samr21-xpro.

There is another thread flags test thread_flags_xtimer which seem somewhat redundant now. Could it be removed? @haukepetersen @kaspar030
https://github.com/RIOT-OS/RIOT/blob/master/tests/thread_flags_xtimer/main.c

@kaspar030
Copy link
Contributor Author

There is another thread flags test thread_flags_xtimer which seem somewhat redundant now. Could it be removed? @haukepetersen

Hm, that test was showing a bug in thread_flags, IIRC the thread flag was only triggered the first time. @haukepetersen what do you think, remove the test?

@jnohlgard
Copy link
Member

Can we modify this test to catch that kind of error as well?

@kaspar030
Copy link
Contributor Author

kaspar030 commented Sep 5, 2017

Can we modify this test to catch that kind of error as well?

I think the best way would be to do proper unit tests. How about we merge this and go from there?

There are some follow-ups anyway:

  • xtimer_set_timeout_flag64()
  • make xtimer_sleep* use them
  • make xtimer_msg_timeout use the thread flag
  • ...

@jnohlgard
Copy link
Member

I'm fine with some follow ups

@kaspar030 kaspar030 merged commit 516aca6 into RIOT-OS:master Sep 5, 2017
@kaspar030 kaspar030 deleted the add_xtimer_set_timeout_flag branch September 5, 2017 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants