Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

-1 votes
0 answers
93 views

Capture of 'self' with non-sendable type 'Type?' in a `@Sendable` closure

I have a warnings 'Capture of 'self' with non-sendable type 'Type?' in a @Sendable closure' for this code func launchPairingAtCorrectStepAfter(timeout: TimeInterval) { Timer.scheduledTimer(...
Taghouri Dessah's user avatar
1 vote
1 answer
129 views

Should I make my service Sendable? Issues with concurrency in Swift

I have multiple services implemented through protocols to be able to inject a mock service on initialization of ViewModels, and after enabling strict concurrency check I have many warnings "...
adseeAnn's user avatar
2 votes
1 answer
60 views

Java concurrency problem with enums and references

I'm having a concurrency problem when I update an object through an Enum's referenced field. Code here on jdoodle and Github. After setting the object's field, with the method Car#start through ...
kasapkiloet's user avatar
0 votes
1 answer
51 views

C++ unordered_map thread safety when inserting indepentent keys

C++ Container thread safety guidelines at http://en.cppreference.com/w/cpp/container#Thread_safety say Different elements in the same container can be modified concurrently by different threads So ...
pyrometer's user avatar
  • 881
0 votes
0 answers
65 views

Multiple Processes, Multiple Processors, Single Priority Queue - Java Thread-Safe and Concurrency -

Currently I am working on a Java question that is related to Java thread and concurrency. The thread should handles Multiple Processes, Multiple Processors and Single Priority Queue. It has 5 main ...
lucas lootan's user avatar
1 vote
1 answer
59 views

Issues with Concurrent Execution and Synchronization in a Custom Java Caching Mechanism

I’m developing a custom caching mechanism for my Java application to cache objects that are expensive to create (e.g., database connections). The idea is to allow concurrent access to the cache while ...
Mustafa Abudalu's user avatar
0 votes
1 answer
31 views

Why is SpringApplicationBuilder.run made as thread-safe?

The following codes come from Spring Boot SpringApplictionBuidler. I know it uses double-checking to implement thread-safe. The question is that, is it necessary to make the run method thread-safe? ...
Droopy's user avatar
  • 3
0 votes
1 answer
98 views

Different threads updating different attribute of the same object, will it work?

I have one method as follows: public Book enrichBook(Book book) { Long bookId = book.getId(); Thread t1 = new Thread(() -> book.setAuthors(authorService.findByBookId(bookId))); Thread t2 = ...
Tom's user avatar
  • 95
0 votes
1 answer
123 views

How to avoid Duplicate Document Numbers for Invoice created through netsuite RESTAPI

I'm using Netsuite REST APIs to create invoices. The invoice document numbers (tranid) are auto-generated using Netsuite setup. All my APIs are implemented in AWS Lambda functions, which are ...
RGArun's user avatar
  • 1
-1 votes
1 answer
493 views

In Rust, how to create a globally shared singleton with `OnceLock`?

Assuming that we need to define a singleton with global read access with thread safety, the canonical method is to use OnceLock: /// A synchronization primitive which can be written to only once. /// /...
tribbloid's user avatar
  • 4,028
-2 votes
2 answers
105 views

Are there any concurrency considerations if an object is passed to multiple asynchronous functions in C#? [closed]

So, I have a use case where I want to pass an object to async functions working concurrently. Each function will update different independent part of the object. So, my doubt is will this cause any ...
Anuj's user avatar
  • 623
-1 votes
2 answers
65 views

Concurrently changing List<T> from multiple async functions in C#

So, I have a use case where I want to pass a list to async functions working concurrently. Each function will append their result to the list passed. So, my doubt is will this cause any concurrency ...
Anuj's user avatar
  • 623
2 votes
2 answers
111 views

Bizarre concurrent behavior when I cast `ConcurrentDictionary` to an `IDictionary`

I have the following test: using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading.Tasks; public class Program { public static void Main() ...
Daniel Fath's user avatar
  • 17.6k
0 votes
2 answers
116 views

gorm randomly returned nil for a count query

For paging purposes, we have two queries running concurrently, the main query fetches the items (limit to the page size) and the other query runs in a goroutine which queries the total count of items ...
gongqin's user avatar
  • 63
0 votes
0 answers
50 views

How do I lock my C++ function based on a parameter such that other threads calling with that same parameter cannot access it

I am building a C++ Limit Order Book, with a very high focus on speed of execution, and would like to optimise my order matching function such that it can be accessed by multiple threads as ...
gmandonnan's user avatar

15 30 50 per page
1
2 3 4 5
47