Comments (4)
For consistency reasons, I would also rename
osThreadId_t osThisThreadGetId (void);
osStatus_t osThisThreadYield (void);
__NO_RETURN void osThisThreadExit (void *exit_ptr);
Actually all functions that do not have a osThreadId_t
parameter refer to the current thread.
In CMSIS++ all functions that refer to the current thread are part of the this_thread
namespace (or are prefixed with os_this_thread_
in the C API).
from cmsis_5.
There are situations where you want to stop a certain operation, but you do not want to abort it. In this case the suspend is initiated by other threads.
from cmsis_5.
if the purpose is to interrupt a thread, then suspend() is probably the least effective method.
as explained in #67 (and#83), suspend() and resume() are the basic scheduler primitives, and their semantic is to remove/add the thread to the READY list, exposed as the SUSPENDED/READY thread state codes.
suspending a thread does not guarantee that it will be stoped, because immediately after suspend() a timeout may occur, and the thread will be resumed, or even an expected event may occur (if waiting on a semaphore, a post() occurs on interrupts, etc).
stopping/interrupting a thread is a different story (see #68) and, to happen in an orderly manner, requires a two way protocol: one thread requests the interruption and sets a flag, the interrupted thread checks the flag and, if set, aborts what it was doing, and clears the flag. this flag should also be checked by all blocking functions, to cancel the wait and return a specific EINTR code.
I don't know, there might be situations when one thread suspends another, but I would say this usage is the result of a poor design; normally a thread, when nothing to do, removes itself from the ready list and, when an event occurs, some other thread or interrupt puts it back into the ready list.
from cmsis_5.
We have updated the thread documentation.
It should be clear now that osThreadSuspend()
removes the target thread from the ready list under all circumstances. The thread will be rescheduled after calling osThreadResume
, not under any other condition. So a suspended thread should not be resumed on a timeout or a semaphore becoming available.
Btw: To leave it up to the user we decided not to restrict the context a thread can be suspend from. This might be due to a poor design. But we do not want to introduce arbitrary limits on API level.
Please be so kind and close this issue if your questions are answered so far.
from cmsis_5.
Related Issues (20)
- SVD multiple enumeratedValues occurrences meaning HOT 2
- Filter State variable access with Python Wrapper for arm_biquad_casd_df1_inst_f32 HOT 1
- Issues with new ARMv8 MPU attributes HOT 1
- Issue with osDelay in TC_osKernelResume_1 HOT 2
- RTX4 EXCLUSIVE_ACCESS macro undefined for GCC compiler HOT 2
- Versioning of CMSIS Core missmatch HOT 3
- Add HOST support HOT 2
- Output Mismatch in ARM mult , scale, Complex real mult in CMSIS 5.9 version HOT 1
- `CMSIS_DEPRECATED` for Cortex M? HOT 1
- Error in the description of CMSIS-SVD HOT 1
- The number of `enumeratedValue` elements in the `enumeratedValues` element if the `derivedFrom` attribute is present HOT 6
- EMAC_iMXRT1064.c file is not compatible with fsl_enet driver in Keil HOT 3
- [SVDConv] `writeConstraint` in `register` crashes SVDConv HOT 2
- How to build a library in the Ti env. HOT 1
- Thread switch on osKernelRestoreLock? HOT 2
- RTOS2 - memory block pools vs byte pools? HOT 7
- armv8-m register define doesn't include BPU HOT 2
- Extension of osKernelGetTickCount() to provide monotonic tick counter is in error. HOT 3
- Git LFS Data Limit Exceeded HOT 4
- Core Armv8 ARM_MPU_SetMemAttrEx include undefined behaviour
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 cmsis_5.