Hey all,
I'm thinking about making repeated calls (spinning) to QueryPerformanceCounter in two threads that will be active at the same time. I'm not sure if this is really an issue as I've not seen anything written about it but is QueryPerformanceCounter thread safe?
Thanks
...
I'm using an automatically created (with wsdl.exe and the GUI-based "Add web reference" command) web service for LyricWiki.org. However, since my internet connection is sucking lately, it's been taking ages to complete and is annoying me.
I'm trying to make it timeout in 2000ms by using the .Timeout property, but it still hangs. I also ...
i want to do this simple piece of code work.
#include <iostream>
#include <windows.h>
void printSome (int i)
{
std::cout << i << std::endl;
}
void spawnThread (void (*threadName)(int i))
{
CreateThread
(
0, // default security attributes
0, // use default stack s...
For whatever reason, ThreadPool's QueueWorkItem doesn't return an IAsyncResult or some other handle to the work item, which would allow to wait until it's completed. There are RegisterWait... methods, but you have to pass a WaitHandle and creating them is expensive (see IAsyncResult documentation, which advises you to delay creating a Wa...
From a web service (WCF), I want an endpoint to take 10 seconds to finish.
Is there a way I can do a thread.sleep(10); on the method?
...
I have an IDictionary<TKey,TValue> implementation that internally holds n other Dictionary<TKey, TValue> and distributes that insertions by the HashCode of the key to the invidual sub-dictionaries. With 16 sub-dictionaries, the number of collisions is pretty low on a 4-core machine.
For parallel insertions, i locked the Add-method with ...
I've got a highly multithreaded app written in Ruby that shares a few instance variables. Writes to these variables are rare (1%) while reads are very common (99%). What is the best way (either in your opinion or in the idiomatic Ruby fashion) to ensure that these threads always see the most up-to-date values involved? Here's some ideas ...
Can anyone give me a scenario where they think busy cursors are justified? I feel like they're always a bad idea from a user's perspective. Clarification: by busy cursors, I mean when the user can no longer interact with the application, they can only move their hourglass mouse pointer around and whistle a tune.
...
This is a complex question, please consider carefully before answering.
Consider this situation. Two threads (a reader and a writer) access a single global int. Is this safe? Normally, I would respond without thought, yes!
However, it seems to me that Herb Sutter doesn't think so. In his articles on effective concurrency he discuss...
or should you always create some other lock object . .
...
I'm trying to write a small wsgi application which will put some objects to an external queue after each request. I want to make this in batch, ie. make the webserver put the object to a buffer-like structure in memory, and another thread and/or process for sending these objects to the queue in batch, when buffer is big enough or after c...
You always hear that functional code is inherently easier to parallelize than non-functional code, so I decided to write a function which does the following:
Given a input of strings, total up the number of unique characters for each string. So, given the input [ "aaaaa"; "bbb"; "ccccccc"; "abbbc" ], our method will returns a: 6; b: 6; ...
Hi,
I've got a small app that searches for and stores the names of a large number of files at start-up. I'm splitting this search into several Thread objects that each search one directory, and push results back to the main thread.
When the app loads, I go through each thread and load it:
foreach(Thread t in m_threads)
{
t.Start(...
What is a common real life use for Dispatcher.DisableProcessing in WPF? Can I use it to suspend rendering and layout when I build a complex UI in code?
...
Not really a question, more of a reference list:
Boost.Thread was heavily modified since 1.34, to conform to upcoming C++0x standard. Thus, most tutorials I can find on the web can be considered obsolete.
Today, Boost's version is 1.37, and the only links I found on the web were:
Boost 1.37 Threads http://www.boost.org/doc/libs/1_37_...
I'm working on an application that is distributed over two JBoss instances and that produces/consumes JMS messages on several JMS queues.
When we configured the application we had to determine which threading model we would use, in particular the number of producing and consuming threads per queue. We have done this in a rather ad-hoc f...
In Java, the idiomatic way to declare critical sections in the code is the following:
private void doSomething() {
// thread-safe code
synchronized(this) {
// thread-unsafe code
}
// thread-safe code
}
Almost all blocks synchronize on this, but is there a particular reason for this? Are there other possibilities? Are ther...
I'm learning about POSIX threads right now, but I guess this is just a general question on multithreading, so I hope that anyone can help me. I have this example from the book that I am working on which demonstrates a race condition:
void *thread_main(void *thread_number) {
printf("In thread number %d.\n", *(int *)thread_number);
}
...
I have inherited some majorly spaghetti code (combination C#/VB) that I'm trying to understand here.
This appears to be a really weird situation where there are two successive calls to fire events to a remote object, which is being done by calling the DynamicInvoke method of a delegate, of the form:
delegate1.DynamicInvoke(args1);
// s...
The short form of this question: When, if ever, is it appropriate to use the Forms.Timer in a multithreaded WinForms application?
More specifically, I am architecting an application that uses multiple System.Threading.Timers to launch processes asynchronously, check queues containing the results of those asynchronous processes, and upda...