Hi,
in this code:
int foo() {
static int x;
}
is the x global to all threads or local in each thread? Or does that depends on a compiler flag and/or the compiler, so I cannot really know what it is from the code?
Several questions (all of them independent from compiler and compiler flags and OS):
How can I create a static varia...
We have an implementation for an Ultrasound machine application current where the Ultrasound object is created on the UI's thread. A Singleton implementation would have been good here, but regardless, isn't.
Recently, the set methods changed such that they automatically stop and restart the ultrasound machine, which can take between 10-...
Is it necessary to use a temporary here to be thread-safe?
int getVal() {
this->_mutex.lock();
int result = this->_val;
this->_mutex.unlock();
return result;
}
I'll give you disassembly of simple RAII test function
int test()
{
RAIITest raii; //let's say it's a scoped lock
return 3;
}
{
0...
I've written an API that will be used on the same box in (1) a windows service, (2) a web application, and (3) a windows forms application. They all need to share a very small set of common data (a few ints, a date, and a string that I could put as properties of a single class).
What sort of locking mechanism can I use cross-process so...
OK I am not only new to concurrency in java but am also fairly new to java programming. I tried understanding concurrency from The java tutorials, tried reading Concurrency in practice but it seemed too advance, so tried reading from couple of other books: SCJP A comprehensive, The java programming language 4th edition.
Its as if there ...
In WPF we have two threads (at least): rendering and a UI thread. When I raise an event OnNotifyPropertyChanged on some property changes, it is raised on the UI thread. This information needs to be dispatched to WPF rendering thread for re-rendering. I am assuming it is done in a synchronous manner ( Dispatcher.Invoke ) but how does it r...
Can you create a child window from a secondary child thread or it must be created from GUI thread? Assuming the life time of child thread is until the end of program.
...
I am working on a Tetris AI implementation. It is a GUI application that plays the game by itself. The user can manipulate a few parameters that influence the decisions made by the AI. The basic algorithm goes as follows:
Start a new thread and clone the current game state to avoid excessive locking.
Generate a list of all possible fut...
I wanted to know what would be better/faster to use POSIX calls like pthread_once() and sem_wait() or the dispatch_* functions so I created a little test and am surprised at the results (questions and results are at the end).
In the test code I am using mach_absolute_time() to time the calls. I really dont care that this is not exactl...
I have an application that start System.Threading.Timer, then this timer every 5 seconds read some information from a linked database and update GUI on main form of application;
Since the System.Threading.Timer create another thread for the Tick event, i need to use Object.Invoke for updating User Interface on the main Form of applicati...
I have been developing an iPad application in which I want to implement multithreading, so that I can use background threads for network communication.
I tried NSThread and NSOperation but I can't get a proper mechanism for thread communication in NSThread and the application crashes randomly when I use NSOperation and NSOperatioQueue.....
Hi All
I am going through the kathy sierra SCJP 1.5 Chapter 9(threads) and there it is mentioned as:
Notice that the sleep() method can throw a checked InterruptedException
(you'll usually know if that is a possibility, since another thread has to explicitly do
the interrupting), so you must acknowledge the exception with a hand...
In Swing, the GUI is supposed to be updated by the EDT only, since the GUI components are not thread safe.
My question is, if I have a single thread, other than the EDT, that is dedicated to update a specific component, and this component is not accessed by any other thread in my program, only this dedicated thread, is it ok? In my case...
I am not clear about thread confinement.
In swing all the gui components must be updated through the EDT. SwingWorker is provided in Java6 for lengthy operations, and in the done method the gui components can be updated. My understanding was that the gui components in the done() method are updated in the EDT. Therefore there should be no...
After getting fed up with c3p0's constant locking I'm turning to boneCP for an alternative Connection Pool for my Database. I have a server app that processes around 7,000 items per minute and needs to log those items into our mysql database. I currently have 100 worker threads and have set up my Pool like such:
BoneCPConfig config = ne...
Does anyone know of a decent reference for synchronization issues in C++? I'm thinking of something similar to the C++ FAQ lite (and the FQA lite) but with regards to concurrency, locking, threading, performance issues, guidelines, when locks are needed and when they aren't, dealing with multithreaded library code that you can't control,...
I am developing a C++ application that needs to process large amount of data. I am not in position to partition data so that multi-processes can handle each partition independently. I am hoping to get ideas on frameworks/libraries that can manage threads and work allocation among worker threads.
Manage threads should include at least be...
The Linux Kernel is said to be SMP.
It is said that processes and kernel threads shall be distributed across processors.
Does all Linux distribution like fedora13, ubuntu 10.04 Lucid by default enable SMP Linux?
On an SMP Linux, which is better to follow-
a) multi-process approach
versus
b) multi-threading approach
Does pthrea...
Hi.
I'm having a weird issue, with a Cocoa, OpenGL application I am working on. Whenever I launch my application I am getting the following messages / assertion failure on the console, related to eh NSUndoManager. I am not using the undo manager, by the way.
2010-09-05 03:28:49.184 CocoaCoreTest[51721:a0f] *** Assertion failure in +[NS...
I download a file by e.g. 5 threads. When one of the threads completes downloading the file part - it is aborted, BUT all of the rest threads has the ThreadState = WaitSleepJoin and obviously stops downloading. How to resolve that ?
while ((bytesSize = responseStream.Read(Buffer, 0, Buffer.Length)) > 0)
{
lock(fileStream)
{
...