Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Coroutines package for U++
Re: Coroutines package for U++ [message #59134 is a reply to message #59133] Mon, 07 November 2022 20:30 Go to previous messageGo to previous message
peterh is currently offline  peterh
Messages: 108
Registered: November 2018
Location: Germany
Experienced Member
I understand it this way, C++20 coroutines are meant to write fast state machines in a simpler way.
In earlier times in plain old C longjump() could be (ab)used for this, but more complicated.

I have implemented sort of a coroutine in assembler for a device driver for an embedded device which had to handle XON/XOFF handshake and timeout properly without deadlock and I implemented the interrupt routine as a coroutine which was called by UART interrupt. This simplified the job a lot.

I do yet not understand, where does a C++ coroutine store its local variables?
On yield the stack is destroyed, so it must store the local variables elsewhere because these are persistent. (Local variables are still alive at the next invocation)

[Updated on: Mon, 07 November 2022 20:32]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Possible enhancement on UppHub
Next Topic: Links in UppHub
Goto Forum:
  


Current Time: Sat May 10 16:40:46 CEST 2025

Total time taken to generate the page: 0.03258 seconds