I have a GUI which has textarea and buttons and etc.........
I have a different class which is a thread that is running constantly. I want to append text to the textarea when certain conditions are met in the thread class.
In the class containing the textarea i have getter methods for the textarea. I have also declared that class(conta...
I know how to use LOCK to thread-safely increment a value:
lock inc [J];
But how do I read [J] (or any value) in a thread-safe manner? The LOCK prefix can't be used with mov. And if I do the following:
xor eax, eax;
lock add eax, [J];
mov [JC], eax;
It raises an error on line 2.
...
I have a C++ singleton that runs as a separate thread. This singleton is derived from a base class provided by a library and it overrides the method onLogon(...). The onLogon method is synchronous, it wants to know right away if we accept the logon attempt.
Problem is we need to pass the logon information via message to a security ser...
I know how to atomically write a value in x86 ASM. But how do I read one? The LOCK prefix can't be used with mov.
To increase a value, I am doing:
lock inc dword ptr Counter
How do I read Counter in a thread-safe way?
...
Some stated that python dictionary is thread safe. Does it mean I can or cannot modified the items in a dictionary while iterating over it?
...
In my project I am using SharedCache as a distributed caching mechanism. There are multiple instances of a service deployed in webfarm which accesses this cached data. The data which is cached is transient and can have updates. I would like to know if there is any way we can synchronize the access to the data between two or more services...
Hi,
I have a linked list samples:
protected LinkedList<RawDataset> samples = new LinkedList<RawDataset>();
I'm appending elements to the list in thread 1 like this:
this.samples.offer(data);
And I'm retrieving elements from it in a second thread like so:
public RawDataset retrieveSample() {
return this.samples.poll();
}
Wou...
I've problem understanding the following piece of code:-
public class SoCalledSigleton{
private final static boolean allDataLoaded = SoCalledSigleton();
private SoCalledSigleton(){
loadDataFromDB();
loadDataFromFile();
loadDataAgainFromDB();
}
}
Is this piece of code thread safe? If not t...
Is the BlackBerry version of SimpleDateFormat, net.rim.device.api.i18n.SimpleDateFormat thread safe? I know that java.text.SimpleDateFormat is not but there is no mention if net.rim.device.api.i18n.SimpleDateFormat is thread safe or not. Should we assume if it is not stated then it is not thread safe?
...
Where do i get the ISynchronizeInvoke so i can sync against UI thread?
System.Timers.Timer gTimer;
gTimer.SynchronizingObject;
...
I have an interface in CLR between SQL Server and the Exchange Web Services to Sync and send emails between applications. In testing this it works(ed) without any problems; we are seeing sporadic issues in the production environment where longer web service task appear to be have overlapped.
My question is very simple and I cant decide ...
I am trying to figure this out, given the following code, does the Refresh() need to occur on the UI thread? It seems to work, and I am wondering if the CollectionViewSource is actually a thread-aware / safe object? It definately has properties and methods to support calling on the correct thread, just not sure if that is left up to th...
Hi,
I'm trying to track down the source of a particular piece of coding advice I once read.
I'm currently working with a class that has a lot of threading around a single shared resource, controlled by a mutex. I just spent a week trying to debug the damn code, because it's difficult to spot sub-functions which don't self-lock, and...
I am using some software that requires me to have thread safety disabled. I am working on a Windows server. From what I've read elsewhere, I can't just configure this in the .ini file. Is this true? If so, how would I compile it so that thread safety is turned off?
Thanks!
...
I have class where a bool is access concurrently. However in my case it is only initialized to false once in the constructor, and after that it set to false. Am i correct to believe that even though a race might occur the result will be valid and defined? Since the entire bool doesn't have to be written to inorder for "!isStopping_" to ...
What is the best way to atomically lock multiple files? One possibility I've thought of is a simple .lock file in the directory (I'm only protected from other instances of my program; I'm not necessarily trying to thwart other programs from disrespecting the lock.) However, everything I've learned about thread-safety screams "bad idea!" ...
Hi, everyone,
my program had been blocked , I used the jstack commander to analyze, the following thread took the lock "0x0000000603f02ae0" , and others threads couldn't fetch the lock.
I had waited at least one hour, but the thread didn't unlock , my question is why the thread'state is RUNNING, and stop at java.util.HashMap.getEntry(Has...
Full disclaimer: this is not really a homework, but I tagged it as such because it is mostly a self-learning exercise rather than actually "for work".
Let's say I want to write a simple thread safe modular counter in Java. That is, if the modulo M is 3, then the counter should cycle through 0, 1, 2, 0, 1, 2, … ad infinitum.
Here's one...
Hi,
There is a JDK function that, although the javadocs does not declare it as thread-safe, from looking at the code in Google, it seems that I could get the result I want by calling it from multiple threads without undesirable side-effects, since the function uses mainly stack variables. So it does not matter if it has synchronized blo...
I have never asked questions in any community as I always solved problems by myself or could find them online. But with this one I came to dead end and need Help!
To make it very clear – I converted a simple app, found elsewhere to make it use a Tthread object.
The idea is simple – the app checks online using webservice, through THTTPRIO...