Questions tagged [structured-concurrency]

Structured concurrency is a style of multi-threaded programming where concurrent subtasks are spawned within a code block, and they will all return to the same place: the end of the code block. The name is related to 'structured programming', in that the syntactic structure of the code has meaning.

22 questions
0
votes
0 answers

Is there a way to co-ordinate coroutines using on Dispatchers with wait statements across codeblocks

I have a situation with a lot of callbacks, specifically onCompleteListeners from Firebase Auth. First I am getting a Firebase Auth object using an SDK. However there is no other option but to use an onCompleteListener. Then I need to use another…
0
votes
1 answer

How to convert callback functions into Senders model?

For example, many functions in ASIO is callback-style (e.g. async_read_some()), and NVIDIA stdexec or Facebook libunifex is based on Senders model (std::execution). How to make callback-style function and Senders model work together?
Bryan Yan
  • 13
  • 3
0
votes
2 answers

Using coroutineScope function vs passing CoroutineScope as argument

Using coroutineScope in a suspend function that will be called from a CoroutineScope, is it giving the same result as passing that CoroutineScope as a parameter to the suspend function ? import kotlinx.coroutines.coroutineScope suspend fun…
0
votes
1 answer

CoroutineScope vs coroutineScope vs CoroutineScope extension function

I’m currently learning about Coroutines. I’am following JetBrains’ hands-on: Intro to coroutines and channels. In Structured concurrency section, they mentioned this: It’s possible to create a new scope without starting a new coroutine, by using…
Ismaïl
  • 60
  • 1
  • 7
0
votes
1 answer

Is there a way to get rid of a new concurrency warning on a @Published variable

I'm currently working on a new iOS project. To be up to date with the new concurrency from Swift I have switched the Strict concurrency checking setting too "complete". This has of course sprung up lot's of warning and error that I was mostly able…
0
votes
1 answer

Run function after two functions has ran

So let's say I have these three functions: func func_1() { Task { @MainActor in let state = try await api.get1State(v!) print("cState func_1: \(state!)") } } func func_2() { Task { @MainActor in let state = try…
-1
votes
1 answer

What is Structured Concurrency?

This is a sort-of terminology question. One of the features of Java 19 is "Structured Concurrency". Why is that so-named? is it because the asynchronous code is not truly parallel? We are lead to believe that these fibers or virtual threads are like…
HellishHeat
  • 2,280
  • 4
  • 31
  • 37
1
2