Questions tagged [concurrency]
In computer science, concurrency is a property of systems in which multiple computations can be performed in overlapping time periods. The computations may be executing on multiple cores in the same chip, preemptively time-shared threads on the same processor, or executed on physically separated processors.
concurrency
23,062
questions
0
votes
1
answer
12
views
GRPC Java MAX_CONCURRENT_STREAMS vs maxConcurrentCallsPerConnection
I'm trying to understand the difference between MAX_CONCURRENT_STREAMS and maxConcurrentCallsPerConnection. I read that most servers set MAX_CONCURRENT_STREAMS to 100 as a default whereas ...
1
vote
1
answer
46
views
Passing argument of non-sendable type '(any URLSessionTaskDelegate)?' outside of main actor-isolated context may introduce data races
I am using SwiftUI and I declared the View as @MainActor to resolve some of the concurrency warnings. However, I still get the warning
Passing argument of non-sendable type '(any ...
0
votes
1
answer
27
views
Go channel sometimes not receiving the last value
I'm currently learning go channels, and I'm trying out this piece of code. It creates 10 goroutines which sends a 1000 1s each to a channel. Then another go routine receives it and adds it to a ...
-1
votes
1
answer
45
views
Using AtomicInteger as counter for List [closed]
I am learning multi threading. I have below code which implements round robin algorithm over an CopyOnWriteArrayList. List will always have a fixed number of elements let's suppose 10.
...
0
votes
0
answers
43
views
C++ main thread polling and blocking, termination on signal
I have a main thread which should do some work every N seconds (20 in this case) and wait/block/suspend in-between. However, at the same time, I want the application to stop correctly on a SIGTERM/...
1
vote
1
answer
39
views
Java CopyOnWriteArrayList add element if not exists already
I have an CopyOnWriteArrayList as my code should be thread safe.
List friuts = new CopyOnWriteArrayList<>();
I don't want to have duplicate friuts in list I cannot use Set as I want to have ...
0
votes
0
answers
12
views
Streamlit: keep fragment running while the page loads
I have a Streamlit UI with this code
import streamlit as st
import time
_LOREM_IPSUM = """
Lorem ipsum dolor sit amet, **consectetur adipiscing** elit, sed do eiusmod tempor
incididunt ...
0
votes
1
answer
79
views
ProgressView Not Updating During Data Parsing in SwiftUI
It's hard to reproduce the full code, but I'll try to explain the issue clearly.
I'm trying to display a progress bar view to show the status of parsing some data downloaded online. The function I use ...
0
votes
0
answers
47
views
Request Chunks from the peer in parallel in golang over a tcp connection
I'm building a P2P file transfer system in Go that fetches chunks of data from peers in parallel. While sequential requests work fine, parallel requests using goroutines behave inconsistently, ...
1
vote
0
answers
121
views
Capture of 'self' with non-sendable type in a `@Sendable` closure
I'm working on a NetworkService class in Swift that uses async/await and observes network state changes. I'm converting the code to Swift 6.0 and I'm getting the following error on the line inside ...
-2
votes
0
answers
91
views
Asyncronous function don't run in the correct order [duplicate]
Why is my code not running in the correct order?
I can’t figure out why my code is not executing in the correct order. My downloadData function includes and should run the following three functions in ...
1
vote
2
answers
27
views
Django ORM model 'save' method and race condition / ACID Isolation
if we examine the following code:
class SomeModel(models.Model):
...
def save(self, *args, **kwargs):
self.validate_unique()
super().save()
def validate_unique(self, *args,...
0
votes
0
answers
9
views
SubscriberContext state in case of concurrent HTTP Request in spring reactive
I have an HTTP API written in Spring Reactive which fetches user details from the datastore. I am adding the description for the API below.
@Configuration
class Routes {
@Bean
fun router() = ...
2
votes
1
answer
30
views
Manage concurrent users per single subscription
I am implementing a functionality in which user can take one subscription &** maximum 10 account can be created per single subscription but only 3 concurrent users are allowed**.
I am using ...
1
vote
1
answer
70
views
Multithreaded program not running as expected
I was trying to learn about semaphores, reading The Little Book of Semaphores by Allen B. Downey.
In that there is a puzzle:
Generalize the rendezvous solution. Every thread should run the
following ...