I'm wondering whether prepared statements in Android (instances of SQLiteStatement) are thread-safe. In particular I'm asking with regard to the following scenario:
In a ContentProvider you create a pre-compiled insert statement during onCreate. Then, in the overriden insert method you make use of this statement by binding a set of para...
I attended an interview today in which the interviewer asked me the following question :
Is re-entrancy and mutual exclusion thread-safe ? Can you explain why ?
I am relatively new to concurrent programming and could not answer it.. But i said ...
Mutual exclusion is thread safe . But re-entrancy is not and that is the reason why we h...
Hello,
Can anyone suggest the way so i can create a progress bar to show on the status bar while pressing e.g. a button in a RibbonControl and while this form is creating and loading the progress bar shows some progress. If I try some code like .ShowProgressBar -> position value -> create and load the form -> position value -> .HideProg...
Hi guys,
I use very often RIA WCF Services and I inject the same context in several ViewModel. My problem is that as you know, the context of RIA Services, is not thread safe.
So I my solution "home made" for synchronization. I use backgrounds workers, and using PostSharp, I apply my attribute
[UniqueThread ("Data")] on the method and ...
Hi
In this code, why has been written "Not thread safe"?
Thank you
class Singleton
{
private static Singleton _instance;
// Constructor is 'protected'
protected Singleton()
{
}
public static Singleton Instance()
{
// Uses lazy initialization.
// **Note: this is not thread safe.**
if (_instance == null)
{
...
In javadoc for ConcurrentHashMap is the following:
Retrieval operations (including get) generally do not block, so may overlap with update operations (including put and remove). Retrievals reflect the results of the most recently completed update operations holding upon their onset. For aggregate operations such as putAll and clear,...
Is it true that if I only use immutable data type, my Java program would be thread safe?
Any other factors will affect the thread safety?
*Would appreciate if can provide an example. Thanks!
*
...
Also known as the <<"User has many Databases" question.>>
The environment
My app is modeled like so:
user has_many databases
database has_many tables
table has_many rows
row habtm(+value) columns
you get the idea!
So instead of modelling a database inside a database,
I would like to have:
a sqlite3 database that h...
Consider the below struts Action class in which, I am using a StringBuilder variable inside the execute method. My question: Is the variable sb threadsafe or not?
public DemoAction extends Action
{
......
public ActionForward execute(.....)
{
StringBuilder sb = new StringBuilder();
}
}
What if the same variable...
hi, i need to know, whether the hibernate's session is thread safe or not. But obvious a new session is attached to every thread for execution. But my question is if in one thread i have updated some value of an entity, so will that be reflected in other thread during same time execution?...
My problem is when i fire update from two thr...
I have written a method which should only be called on a particular thread. Is there a standard annotation or note which should be added to the method's javadoc to denote this?
...
I have a library with an API much like this:
public class Library : IDisposable
{
public Library(Action callback);
public string Query();
public void Dispose();
}
After I have instantiated Library, at any time and on any thread it might invoke the callback I have passed to it. That callback needs to call Query to do useful...
Is there anything wrong with the thread safety of this java code? Threads 1-10 add numbers via sample.add(), and Threads 11-20 call removeAndDouble() and print the results to stdout. I recall from the back of my mind that someone said that assigning item in same way as I've got in removeAndDouble() using it outside of the synchronized bl...
I am messing with multiple threads accessing a resource (probably memory). What does "readback" mean in this context?
Any guides will be helpful... Google didn't give me any good results.
...
I have written a python script to use gstreamer (pygst and gst modules) to calculate replaygain tags, and it was crashing inconsistently with various gobject errors. I found somewhere that you could fix this by putting the following boilerplate at the top of your script:
import gobject
gobject.threads_init()
I tried it, and it worked....
I'm writing a unit test with Boost.Unit, and I would like to include basic tests for deadlocks in the code I'm testing. My first idea was to set a deadline timer in one thread while running the test in another that is expected to finish well before the deadline. When the timer goes off, assert that the thread is not running or not interr...
Specifically I'm talking about Python. I'm trying to hack something (just a little) by seeing an object's value without ever passing it in, and I'm wondering if it is thread safe to use thread local to do that. Also, how do you even go about doing such a thing?
...
Can more than one thread safely call methods on an instance of Scheduler returned by the StdSchedulerFactory concurrently?
...
Hi,
I'm having problems with the above much asked-about error. We have a TCP/IP server application which has been working fine for some years. I now need to allow the application to accept connections from directly connected USB devices, by internally using a socket connection to patch through to localhost (127.0.0.1) within the server...
How do I make code like this thread safe?
public static class Converter
{
public static string ConvertNameToNickname(string name)
{
if (name.Equals("John"))
{
return "Johnathon";
}
return name;
}
}
Or is it already thread safe since "name" is a local variable? I just want to mak...