-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Open
Open
Copy link
Labels
EnhancementChanges/Updates/Additions to existing featuresChanges/Updates/Additions to existing featuresarea: APIChanges to public APIsChanges to public APIs
Description
This issue is intended to cover the concerns raised in #1960, #3694, #6184, #17014, and related lack of clarity and consistency.
Proposal: We should have:
- Definitions of terms; see Draft terminology related to API behavior definitions #20959
- A policy for when (kernel and driver) API functions are thread-safe/reentrant. Some are (to varying degrees), some are not.
- At the individual function level we should clearly document:
- Can a call block?
- Any situation where the call doesn't block but also will not return for a very long time (e.g. chip-level flash erase)
- Can the function be invoked from an ISR? What behavior is guaranteed in that situation?
- Are the operations of the function atomic?
- The context in which any callback is invoked.
- Any conditions that must be satisfied before the function is invoked, e.g. holding a lock.
Also are k_is_in_isr()
and k_is_preempt_thread()
sufficient to determine whether it's safe to proceed, or do we also need k_is_atomic()
, #17301, or other technologies?
Example policies might be:
- All driver functions must be invokable from ISRs, but
-EWOULDBLOCK
shall be returned in situations where the requested operation cannot be successfully completed in that context. - All GPIO manipulation functions must be atomic.
If we can define the normal behavior at either a system or driver-specific level, only the exceptions need be documented at the individual function level.
sdalu and de-nordic
Metadata
Metadata
Assignees
Labels
EnhancementChanges/Updates/Additions to existing featuresChanges/Updates/Additions to existing featuresarea: APIChanges to public APIsChanges to public APIs