Hi,
I am creating a context (e.g. TestContext.java) as a singleton in the web application.
Multi struts actions will access the context. Should I create the context attributes as thread-safe?
Thanks.
...
Here I am dealing with a database containing tens of millions of records.
I have an application which connects to the database, gets all the data from a single column in a table and does some operation on it and updates it(for mssql - using cursors).
For millions of records it is taking very very ... long time to update.So I want to mak...
In the following code MessageReceived is on a different thread to label1 and when trying to access it I will get this error:
Cross-thread operation not valid:
Control 'label1' accessed from a
thread other than the thread it was
created on.
foo.MessageReceived += new Agent.MessageReceivedHandler(foo_MessageReceived);
void fo...
Hello, I'm trying to learn the basic jist of a Semaphore in the Dining Philosopher problem. Right now, I have an array of class Chopstick, and each Chopstick has a semaphore with 1 available permit:
public class Chopstick
{
Thread holder = null;
private Semaphore lock = new Semaphore(1);
public synchronized void take() thro...
Hi!
I'm developing a Windows Mobile app (Compact Framework 2.0 SP1) and this code it's generating me an error:
public Image Imagen
{
get
{
return imagen;
}
set
{
imagen = value;
this.Invalidate();
}...
I have a college assignment due quite soon, and I need to be able to call a C++ dll that takes a long time (possibly infinte, it relies on user input)to execute. Im calling this through VB. My VB GUI freezes up when this happens, and I would like to keep the GUI responsive, so that the user can stop this possibly infinte loop.
Can anyo...
Hi,
Is threaded behaviour for Firefox extension possible?
I mean to have a "thread" running per Firefox tab.
Just finished an extension that does something to a page in a Firefox window, but figured out that it would require some major restructuring to get the extension working if I wanted to run the extension logic in every tab.
Met...
How much is read from ThreadLocal variable slower than from regular field?
More concretely is simple object creation faster or slower than access to ThreadLocal variable?
I assume that it is fast enough so that having ThreadLocal<MessageDigest> instance is much faster then creating instance of MessageDigest every time. But does that al...
I am new to the thread model in .net. What would you use to:
start a process that handles a file (process.StartInfo.FileName = fileName;)
wait for the user to close the process OR abandon the thread after some time
if the user closed the process, delete the file
Starting the process and waiting should be done on a different thread t...
I'm using parallel linq, and I'm trying to download many urls concurrently using essentily code like this:
int threads = 10;
Dictionary<string, string> results = urls.AsParallel( threads ).ToDictionary( url => url, url => GetPage( url );
Since downloading web pages is Network bound rather than CPU bound, using more threads than my num...
Hi, I have an adopted implementation of a simple (no upgrades or timeouts) ReaderWriterLock for Silverlight, I was wondering anyone with the right expertise can validate if it is good or bad by design. To me it looks pretty alright, it works as advertised, but I have limited experience with multi-threading code as such.
public sealed c...
This question is about the same program I previously asked about. To recap, I have a program with a loop structure like this:
for (int i1 = 0; i1 < N; i1++)
for (int i2 = 0; i2 < N; i2++)
for (int i3 = 0; i3 < N; i3++)
for (int i4 = 0; i4 < N; i4++)
histogram[bin_index(i1, i2, i3, i4)] += 1;
bin_index is a complete...
Hi
How can I switch back to main thread from a different thread when there is an exception. When an exception is raised on a child thread, I want a notification to be sent to main thread and execute a method from the main thread. How can I do this?
Thanks.
Additional information
I am calling a method from my main method and starting ...
I am calling the SQL Server Reporting Services Webservice from inside an asp.net application. I need to fire off all the subscriptions for a given report. But I don't want the user to have to wait around for it to all happen, so I want to have all the webservice calls inside a separate thread, and return to the user straight away.
I am ...
Related:
How to catch exceptions from a ThreadPool.QueueUserWorkItem?
Exceptions on .Net ThreadPool Threads
If a method throws an exceptions that is called by the ThreadPool.QueueUserWorkItem method where will the exception be thrown? or will it just be eaten?
I mean it will never be thrown on the calling thread right?
...
Hi,
I'm going to retrofit my custom graphics engine so that it takes advantage of multicore CPUs. More exactly, I am looking for a library to parallelize loops.
It seems to me that both OpenMP and Intel's Thread Building Blocks are very well suited for the job. Also, both are supported by Visual Studio's C++ compiler and most other po...
I currently have a thread that listens for data from the network and then runs rules on it. I then want to pass the data to the GUI. I am worried about having a deadlock in the GUI. I cant figure out were to put the mutexes on the GUI side. I am also using c# and dotnet 3.5.
What I have come up with is
1) Using a timer to create an eve...
While reading about the function InterlockedIncrement I saw the remark that the variable passed must be aligned on a 32-bit boundary. Normally I have seen the code which uses the InterlockedIncrement like this:
class A
{
public:
A();
void f();
private:
volatile long m_count;
};
A::A() : m_count(0)
{
}
void A::f()
{
::Inte...
OK, please disregard what has gone before. I'm not getting the errors anymore, so it seems my problem is with getting a Chart to update when I change the values to which the Chart is data bound.
//Disregard below here
Hi all. I have a WinForms application that has a panel, panel1. A background thread creates some other controls that th...
Another cross-language question: can someone tell me what C# Threading constructs best match the Java ReentrantLock and Condition classes? ReentrantLock has lockInterruptibly() and unlock() methods, while Condition has signal() and await() methods. It is this combination that I would like to be able to preserve in the C# code - or some...