Comments (2)
Hi @willmafh ;-)
Signals can interrupt processes [see signal(BA_OS)]. Functions called during signal handling have no unusual restrictions on their use of registers. Moreover, if a signal handling function returns, the process resumes its original execution path with registers restored to their original values. Thus, programs and compilers may freely use all registers without the danger of signal handlers changing their values.
-- abi386-4.pdf
So it would be fine as long as we comply with the constraint described in the "Stack Pointer - Miscellaneous - Proof of Correctness" part of README.md:
The stack pointer should always points to the end of the latest allocated stack frame.
P.S.
Here is also a detailed description about the execution of signal handlers:
https://stackoverflow.com/questions/6949025/how-are-asynchronous-signal-handlers-executed-on-linux
from libaco.
I also found the description about the execution of signal handler in the man2 page of sigreturn is wonderful:
If the Linux kernel determines that an unblocked signal is pending
for a process, then, at the next transition back to user mode in that
process (e.g., upon return from a system call or when the process is
rescheduled onto the CPU), it creates a new frame on the user-space
stack where it saves various pieces of process context (processor
status word, registers, signal mask, and signal stack settings).
The kernel also arranges that, during the transition back to user
mode, the signal handler is called, and that, upon return from the
handler, control passes to a piece of user-space code commonly called
the "signal trampoline". The signal trampoline code in turn calls
sigreturn().
This sigreturn() call undoes everything that was done—changing the
process's signal mask, switching signal stacks (see
sigaltstack(2))—in order to invoke the signal handler. Using the
information that was earlier saved on the user-space stack
sigreturn() restores the process's signal mask, switches stacks, and
restores the process's context (processor flags and registers,
including the stack pointer and instruction pointer), so that the
process resumes execution at the point where it was interrupted by
the signal.
You also could choose to use gdb
to see how signal handler is executing during the call of acosw
(here is a demo may be helpful). Happy hacking :-)
from libaco.
Related Issues (20)
- Request: having a version of aco_yield() that receives the coroutine to where to yield
- 为什么使用自行编写的acosw.S汇编来切换上下文,而不是使用现成的setjmp? HOT 1
- 不再活跃维护/更新/开发了吗? HOT 2
- Document c standard library dependencies
- Status and Future Plans of libaco
- can libaco support yield/resume between threads? HOT 3
- Provide way to return error to caller instead of calling `abort()` on failed assertions HOT 1
- is it worth to create coroutine inside coroutine?
- which one better to pass argument to co function
- 关于libco bug的疑问
- Thread local storage support HOT 1
- Feature request: Ability to return a value from aco_yield() HOT 1
- Feature Request: aco_get_co() return NULL when the caller is main co HOT 4
- is 120byte the lowest we can have? possible to lower this? HOT 1
- Do libaco coroutines run on different CPUs at the same time. i.e. does the program performance benefit from having multiple CPUs HOT 2
- Question: which is faster, creating new coroutines or reusing old coroutines HOT 3
- resume multiple coroutines in parallel HOT 1
- Integrate into our io engine? HOT 1
- add arm32/aarch64 support for android and ios HOT 1
- `aco_amd64_inline_short_aligned_memcpy_test_ok` size alignment
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 libaco.