Is there such a thing as an atomic test-and-set, semaphore, or lock in Javascript?
I have javascript invoking async background processes via a custom protocol (the background process literally runs in a separate process, unrelated to the browser). I believe I'm running into a race condition; the background process returns between my tes...
I have a method that contains an asynchronous call like this:
public void MyMethod() {
...
(new Action<string>(worker.DoWork)).BeginInvoke(myString, null, null);
...
}
I'm using Unity and creating mock objects is not a problem, but how can I test that DoWork is called without worrying about race conditions?
A previous que...
Should I use old synchronized Vector collection, ArrayList with synchronized access or Collections.synchronizedList or some other solution for concurrent access?
I don't see my question in Related Questions nor in my search (Make your collections thread-safe? isn't the same).
Recently, I had to make kind of unit tests on GUI parts of o...
I have a single process that queries a table for records where PROCESS_IND = 'N', does some processing, and then updates the PROCESS_IND to 'Y'.
I'd like to allow for multiple instances of this process to run, but don't know what the best practices are for avoiding concurrency problems.
Where should I start?
...
I want to make my program robust by putting concurrency check, but somehow UpdateCommand fails me even in the most basic update sql. Using Npgsql 2.0.2
var dax = new NpgsqlDataAdapter();
using (var dtStore = delta.Tables["brand"].GetChanges(DataRowState.Modified))
if (dtStore != null)
{
dax.UpdateCommand = new NpgsqlCommand(
@"upda...
My thread runs forever and calls ConcurrentLinkedQueue#poll() after a ConcurrentLinkedQueue#peek().
But under some conditions, the thread seems to hang. I know this is a bit vague
but can people confirm for me that the methods poll() or peek() will NEVER block. Thanks.
...
I created two (or more) threads to insert data in a table in database. When inserting, there is a field CreatedDateTime, that of course, stores the datetime of the record creation.
For one case, I want the threads to stay synchronized, so that their CreatedDateTime field will have exactly the same value. When testing with multi threadi...
I don't know how commercial games work inside very much, but the open source games I have come across don't seem to be massively into threading. Same goes for most other desktop applications, normally two or three threads seem to be used (eg program logic and GUI updates).
Why don't games have many threads? Eg separate threads for physi...
I've done a bit of reading related to the concurrency issues with sqlite, but I don't see how they'd apply to Django since it's inherently single threaded. I'm not using any multiprocess modules either. I have absolutely no experience with concurrent programming either, so if someone can identify WHY the following code is causing an Oper...
I'm referring to monitors as described here:
http://en.wikipedia.org/wiki/Monitor_(synchronization)
None of the definitions here seem apropos:
http://www.thefreedictionary.com/monitor
So why are they called that?
== Update ==
Thank you for the answers, everyone!
I guess I was confused because I don't think of monitors usually as a...
Can any one tell me the advantage of synchronized method over synchronized block with an example?Thanks.
...
This is a jstack output from a running JVM
"FooThread" prio=10 tid=0x00007f159c2ca000 nid=0x6e21 waiting on condition ..snipped
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.myco.impl.QueueFooThread.run(Unknown Source)
I want the line number in QueueFooThread to show up l...
I have some database table and need to process records from it 5 at a time as long as app is running. So, it looks like this:
Get a record that hasn't been processed yet or not processing now by other threads.
Process it (this is a long process that depends on internet connection so it could timeout/throw errors).
Move to the next reco...
I need to make some concurrent XML feed requests in Perl. What is the fastest way to do this?
...
So I'm hosting WCF service in a WinForms application. I have the following
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple,
InstanceContextMode = InstanceContextMode.PerCall)]
public class Test : ITest
{
public string TestIt(string input)
{
Thread.Sleep(5000);
return "test";
}
}
I'm ...
In C# 2.0+, is it necessary to lock around a closure that another thread will execute? Specifically, in the example below, is the locking necessary to ensure that the Maint thread flushes its value of x to shared memory and that thread t reads its value of x from shared memory?
I think it is, but if I'm wrong, please reference e.g. an ...
Here is what I know about concurrency in OS.
In order to run multi-task in an OS, the CPU will allocate a time slot to each task. When doing task A, other task will "sleep" and so on.
Here is my question:
I have a timer program that count for inactivity of keyboard / mouse. If inactivity continues within 15min, a screen saver program ...
There seems to be a lot of fuss about multicore and java. While some people say that java support is not good enough, it definitely seems to be an area to look forward to. There seems to be many techniques to improve performance of concurrent programs.
Any tips/advices about programming in a multi core scenario is appreciated.
...
I am persisting objects using JPA. The Main object has an owning One-Many relationship with another object. The other object is stored in a HashMap. What sort of synchronization would fix this problem? It seems to happen at completely random times and is very unpredictable. Here is the exception I get:
Exception in thread "pool-1-t...
I am fairly naive when it comes to the world of Java Threading and Concurrency. I am currently trying to learn. I made a simple example to try to figure out how concurrency works.
Here is my code:
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ThreadedService {
private ExecutorS...