What are the pros/cons of using the GIT as opposed to CoMarshalInterThreadInterfaceInStream and CoGetInterfaceAndReleaseStream for marshalling COM interfaces across threads?
Are there strong reasons for preferring one method over the other, or is it more a matter of personal preference?
...
I want to stop threads by using a boolean field. I have implemented some code to do this which is as follows:
My thread class is like this:
public class ParserThread implements Runnable {
private volatile boolean stopped = false;
public void stopTheThread() {
stopped = true;
}
:
:
}
And below is the main ...
Hi there, folks.
Here I am again with questions about multi-threading and an exercise of my Concurrent Programming class.
I have a multi-threaded server - implemented using .NET Asynchronous Programming Model - with GET (download) and PUT (upload) file services. This part is done and tested.
It happens that the statement of the proble...
Listbox's ItemsSource is TList
in XImage's Dispose method,
How do I stop the thread which load the thumbnail?
<ListBox.ItemTemplate>
<DataTemplate>
...
<Image.Source>
<PriorityBinding>
<Binding Path="Thumbnail" I...
On Async webservice on complete event, there is a code like belows.
Debug.Assert(Dispatcher.CheckAccess()); // don't do marshaling here- it's already runinng on UI thread!
Does anybody know what happens if I remove this code?
or able answer my questions?
...
Suppose that one has some lock based code like the following where mutexes are used to guard against inappropriate concurrent read and write
mutex.get() ; // get a lock.
T localVar = pSharedMem->v ; // read something
pSharedMem->w = blah ; // write something.
pSharedMem->z++ ; // read and write something.
mutex.release() ; // rel...
On most common platforms (the most important being x86; I understand that some platforms have extremely difficult memory models that provide almost no guarantees useful for multithreading, but I don't care about rare counter-examples), is the following code safe?
Thread 1:
someVariable = doStuff();
atomicSet(stuffDoneFlag, 1);
Thread...
Core Animation uses a background thread to do it's job. Now the problem is this: I have a heavy calculation going on in the main thread. Core Animation immediately freezes until that calculation is done. And then it continues to finish it's animations. I remember reading in a document that CA has a low priority in processing time, meanin...
I have a file that is read and written to. I need to make sure when its been written to, nobody else will try to write to it.
I put a lock on the whole function which allows to either read or write but I still get errors such as
The process cannot access the file 'FILENAME' because it is being used by another process.
public static TY...
Hey guys!
I'm messing around with threads a little bit. Now consider this:
I have a main thread. I start a new thread. In it's entry-point method, I want to make a run loop. Now the documentation tells meh that I have to have a input source. Otherwise my run loop exits immediately. bad. okay. but I have no other input source than my perf...
Hi ,
I have a multi-R/W lock class that keeps the read, write and pending read , pending write counters. A mutex guards them from multiple threads.
My question is Do we still need the counters to be declared as volatile so that the compiler won't screw it up while doing the optimization.
Or does the compiler takes into account that t...
Scenario:
I have 50 (or more) processes running (myproc.exe) that do some business logic.
I want to have a web server that takes simple GET's (/foo.html) and just pass this information (the location of GET) one of the running myproc.exe
myproc.exe's and this exe (the webserver) have named pipes between them (so 50 named pipes) that pas...
Is there a way to print out the current thread id on which the current method is executing on?
(objective-c please)
...
How can I stop a background thread on keyboard flip in android?
...
I have a program that runs in a few threads. The main thread shares an object with the other threads and in the main I have a call to:
synchronized(obj){
do stuff
}
I have a suspicion that the main thread is starved and isn't getting access to obj. How do I raise the priority of the main thread or is it already higher than the oth...
Why does this work,
private void buttonBoo_Click(object sender, EventArgs e)
{
GeckoBrowser.Navigate("http://www.google.com/");
}
and this not?
private void buttonBoo_Click(object sender, EventArgs e)
{
Thread thread = new Thread(delegate()
{
GeckoBrowser.Navigate("http://www.google.com/");
});
thread.Start();
}
...
What is the difference between creating a thead using BackgroundWorker and creating a thread using System.Threading.Thread?
...
lets say i have a background worker in a class that perform db query in a background thread.
i wanna test this class
so i mock my db and return some collection so far so good,
make sure my background worker called the do work
and than i wanna make sure that the finish also happened.
I've noticed that the test pass and fail randomly (...
Hello!
I want to catch all WM_GETMINMAXINFO messages which are sent to the "nodepad.exe" application.
My base app is written in C#, the DLL with the windows hook is written in C.
Let me show you the hook inside the C DLL:
file: dll.h
#ifndef _DLL_H_
#define _DLL_H_
#include <windows.h>
#if BUILDING_DLL
# define DLLIMPORT __declspec...
Hi,
Suppose I have thread 1, the main window UI thread and thread 2, a login UI thread that is modal form.
Now thread 1 executes a piece of code and wants to change a UI element in the login form so it invokes a delegate to change something in thread 2. But when it does so, the login form becomes hidden behind the main window and there...