Comments (3)
A callback in the process context would need a caller in the process context.
ztimer callbacks are a relatively low-level (but thus performant) tool; they are supposed to send messages, unlock mutexes or otherwise interact with atomic data structures.
What do you want to achieve / what do you need an in-process callback for? Depending on your application, it may be suitable to defer work of your application until it has been unblocked by the timer, or to use the event thread.
from riot.
You might want to look into timeout events.
They are executed in the context of the event thread, e.g.
static void _event_cb(void *ctx)
{
printf("This is executed in thread %u\n", thread_getpid());
}
int main(void)
{
static event_timeout_t event_timeout;
static event_callback_t event_cb = EVENT_CALLBACK_INIT(_event_cb, 0);
event_timeout_ztimer_init(&event_timeout, ZTIMER_MSEC, EVENT_PRIO_MEDIUM, &event_cb.super);
event_timeout_set(&event_timeout, 500); /* event will be triggered in 500 ms */
}
from riot.
timeout events is implementing the requested feature
from riot.
Related Issues (20)
- make debug broken on `native`
- "fixup!" tests are ignored.
- stdio_cdc_acm causing corruption of first shell input
- Change name of psa_key_slot_get_slot_number to be more clear
- Removing a TNT global address then adding a new one does not work
- msp430: DWARF line info data is bigger than the space remaining in the section HOT 17
- Deletion of old Wiki Pages HOT 4
- DHCPv6 client: Handling of NotOnLink incorrect HOT 2
- dns_msg_parse_reply() fails for response from DNS64 service
- [tracking] fixing stdio HOT 1
- README in Filesystem example is inconsistent with actual code HOT 4
- 6ln RA PIO with L flag set is not ignored
- [tracking] improving the onboarding experience HOT 12
- gnrc/ipv6: "invalid payload length" - corrupted IPv6 header when ENABLE_DEBUG=1 in mbox.c
- Add information on which features are provided by each board HOT 1
- Allow resizing of the side-nav (in Firefox) HOT 2
- Implement Neighbor Discovery Proxy (RFC 4389) HOT 1
- add board for Flipper Zero
- Make Kconfig data visible in documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riot.