I have a WinForm «Passive View» and a «Controller» where the controller is running a long running function for each element in a list.
I want the following:
The functions shall run sequentially
The view mustn't freeze while looping the list and running the functions
After each function has run, the view shall be updated with the resul...
This is an interview question. How do you implement a read/write mutex? There will be multiple threads reading and writing to a resource. I'm not sure how to go about it. If there's any information needed, please let me know.
Update: I'm not sure if my statement above is valid/understandable. But what I really want to know is how do you...
In my application I update a treeview in a backgrounworker thread. While updating the treeview, the combobox values are not visible. When the treeview is updated, the values appear.
Here's my backgroundworker code:
void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
{
tvCategories.Invoke((MethodInvoker)delegate()
{
...
What are the best C++ threading books one should read? And also, please indicate which threading library it uses and its level like beginner, intermediate, advanced or reference.
...
Hi, I'm looking for a lock-free design conforming to these requisites:
a single writer writes into a structure and a single reader reads from this structure (this structure exists already and is safe for simultaneous read/write)
but at some time, the structure needs to be changed by the writer, which then initialises, switches and writ...
I'd like to have a ScheduledThreadPoolExecutor which also stops the last thread if there is no work to do, and creates (and keeps threads alive for some time) if there are new tasks. But once there is no more work to do, it should again discard all threads.
I naivly created it as new ScheduledThreadPoolExecutor(0) but as a consequence, ...
I have a threadSafe method that gets called by multiple threads. Is there a way to know which thread called it?
...
I feel like I should know the answer to this, but I'm going to ask anyway just in case I'm making a potentially catastrophic mistake.
The following code executes as expected with no errors/exceptions:
static void Main(string[] args)
{
ManualResetEvent flag = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(s =>
{
...
I'm having a problem unit testing a class which fires events when a thread starts and finishes. A cut down version of the offending source is as follows:
public class ThreadRunner
{
private bool keepRunning;
public event EventHandler Started;
public event EventHandler Finished;
public void StartThreadTest()
{
...
Hello, I need help coming up with a way of executing the following sequence using some type of view or layout combination in Android:
I have 3 image objects... say object A, B, and C...
[all objects invisible and layered, one on top of the other... A/B/C, like in a RelativeLayout]-->[fade in object A]-->[display A for 200ms]-->[simulta...
I'm using the phrases Parallel Processing & Multi Threading interchangeably because I feel there is no difference between them. If I'm wrong please correct me.
I'm not a pro in Parallel Processing/Multi-threading. I'm familiar with & used .NET threads & POSIX Threads. Nothing more than that.
I was just browsing through archives of SO ...
I have a need for users to be able to scan a series of items and for each item print off x number of labels. I am currently trying to use a background worker to accomplish this but I have run into a problem where they are scanning items so fast and there are so many labels to print for each item the background worker chokes. This is ho...
Hi,
I am asking question about multithreading in general. For example I locked a mutex and resume the task, then I want to suspend it, my question is, should I unlock the mutex before suspending it? So that when I resume it again with mutex it will resume successfully?
I just got started in multithreaded stuff and I am having a hard ti...
I asked a question about building custom Thread Safe Generic List now I am trying to unit test it and I absolutely have no idea how to do that. Since the lock happens inside the ThreadSafeList class I am not sure how to make the list to lock for a period of time while I am try to mimic the multiple add call. Thanks.
Can_add_one_item_at_...
In Qt, I have a method which contains a mutex lock and unlock. The problem is when the mutex is unlock it sometimes take long before the other thread gets the lock back. In other words it seems the same thread can get the lock back(method called in a loop) even though another thread is waiting for it. What can I do about this? One thre...
I have an MFC application. It is basically just copying files from one drive to another. When I'm copying large files (more than 1 Gb) and I click on my window, my application freezes, but the copying proceeds in the background. Someone told me that I have to use a worker thread. I used it, but it still freezes. When I'm copying small fi...
Could someone help me on this,
i have created simple webservices and it has a queue that keeps xml files send from a client, so whenever webservice client call a method on webserbice , webserbice load this xml to its queue, now i want to have a thread running on webserbice which monitors this queue if there items on the queue take othe...
I am not calling exec() yet my timer and QUdpSocket work just fine. Is exec used to wait for an event to continue?
...
While I try to put the animation update function and physics simulation of a game engine into a seperate thread for execution, I realize the potential race condition of some floating point values (say, position of an object) between the writer thread (animation,physics) and the reader thread (renderer) if both threads are going to access...
First question here: it is a very short yet fundamental thing in Java that I don't know...
In the following case, is the run() method somehow executed with the lock that somemethod() did acquire?
public synchronized void somemethod() {
Thread t = new Thread( new Runnable() {
void run() {
... <-- is a lock...