concurrency
Design alternatives to thread implementation of coroutines for converting a push method into a pull method
I have a collection class that holds lots of different types of data in a compressed format. In order to enumerate over all of the values in the collection is has an Execute(Query, IDataWriter) method[详细]
2023-04-08 15:57 分类:问答how to obtain a lock in two places but release on one place?
i\'m newbie in c#. I need to obtain lock in 2 methods, but release in one method. Will that work? public void obtainLock() {[详细]
2023-04-08 15:57 分类:问答How do I find out when the last party fires Phaser.arrive()?
Given: Executor executor = ...; Phaser phaser = new Phaser(n); for (int i=0; i<n; ++i) { Runnable task = new Runnable()[详细]
2023-04-08 15:18 分类:问答Sample Concurrency projects in Java
I finished reading the first seven chapters of Java Concurrency in Practice. Can you give me any 开发者_如何转开发ideas of sample projects so that my ideas will become solidified ?How about implementi[详细]
2023-04-08 13:00 分类:问答I'm thrilled that this scala snippet uses all of my processors to find the (correct) answer faster but... why does it do that?
So I was messing around with some easy problems to get better at scala and I wrote the following program to calculate primes using an Eratosthenes\'s sieve.When I bump up the number of primes to find,[详细]
2023-04-08 09:47 分类:问答How to implement my own locking mechanism
For an assignment (it\'s for concurrency if you wonder) - I have to implement my own lock (more specific: a TaS, a TTas and an Array-Lock, as described in \"The Art of Multiprocessor Programming\")[详细]
2023-04-08 05:37 分类:问答Why are two AtomicIntegers never equal?
I stumbled across the source of AtomicInteger and realized that new AtomicInteger(0).equals(new AtomicInteger(0))[详细]
2023-04-08 04:42 分类:问答Limiting concurrency and rate for Python threads
Given a number threads I want to limit the rate of calls to the worker function to a rate of say one per second.[详细]
2023-04-08 04:01 分类:问答How and why can a Semaphore give out more permits than it was initialized with?
I am reading the book Java Concurrency in Practice. In a section about java.util.concurrent.Semaphore, the below lines are present in the book. It is a comment about its implementation of \"virtual pe[详细]
2023-04-07 21:31 分类:问答future.get returning before finally executed in Callable on cancel
I\'m have a test that is failing intermittently where a future.get call is returning before the finally block is executed in the Callable, when the future is canceled.Here\'s the basic workflow:[详细]
2023-04-07 19:58 分类:问答