multithreading

Is there a concurrent container library for C++

Possible Duplicate: Is there a production ready lock-free queue or hash implementation in C++ I'm looking for implementations of lock-free containers: Queue Stack Hash Map etc... How about blocking containers: Blocking Queue Blocking Stack Are there any good libraries out there? I would like to refrain from writing the...

Multithreaded ActiveRecord requests in rspec

I'm trying to recreate a race condition in a test, so I can try out some solutions. I find that in the threads I create in my test, ActiveRecord always returns 0 for counts and nil for finds. For example, with 3 rows in the table "foos": it "whatever" do puts Foo.count 5.times do Thread.new do puts Foo.count ...

Is it possible in .NET, using C#, to achieve event based asynchronous pattern without multithreading?

I am amazed by the architectural design of node.js and was wondering if C# is capable of such design: Asynchronous, event based / event loop, non-blocking IO without multithreading. ...

Resources for learning about Threading

I've spent the last year learning and using Java in university but we didn't do much (read: anything) in terms of Threading. We do some next year but I'm hopeful I'll be able to get a head start over the summer. What are the best resources for learning about and getting to grips with Threading? ...

How to flush data in php and disconnect user but keep the script alive

This is a trick question, while developing a php+ajax application i felt into some long queries, nothing wrong with them, but they could be done in background. I know that there's a way to just send a reply to user while throwing the real processing to another process by exec(), however it dosen't feels right for me, this might generate...

Which async call use for DB connection and still responsive GUI?--

Hi, My application connects to MySQL but sometimes it takes a while and the GUI is getting frozen. I would like to do the connection on the other thread, I guess BeginInvoke would be the best way (I know about background worker but I would like to learn this). I have studied MSDN page but I did not understand what is the best way to use?...

Are there concurrency problems when using -performSelector:withObject:afterDelay: ?

For example, I often use this: [self performSelector:@selector(doSomethingAfterDelay:) withObject:someObject afterDelay:someDelay]; Now, lets say I call this 10 times to perform at the exact same delay, like: [self performSelector:@selector(doSomethingAfterDelay:) withObject:someObject afterDelay:2.0]; [self performSelector:@selector...

View every caught and handled exception from all threads

How can I view all the caught and handled exceptions in C# application while debugging, so that I can view where all errors happened and how it was handled. ...

Stream writing lags my GUI

I have a thread that dequeues data from a queue and write it to another application's STDIN. I'm using Stream, but with .Write and even .BeginWrite, when I send 1mb chunks to the second app, my GUI gets laggy for ~1sec. Why? My callbacks are something like this: void Progress(object sender, ProgressArgs e) { if (this.InvokeR...

Python Four steps setup with progressBars

I'm having a problem with the code below. When I run it the progress bar will pulse for around 10 secs as meant to and then move on to downloading and will show the progress but when finished it will not move on to the next step it just locks up. import sys import time import pygtk import gtk import gobject import threading import urlli...

What is wrong with my @synchronized block?

I have 2 threads in my application, a game update thread and render/IO/main thread. My update thread updates the game state, and the render thread renders the scene based on the updated values of the game state models and a few other variables stored inside an object (gameEngine). The render thread gets executed while the game thread is...

How to interrupt a waiting C++0x thread?

I'm considering to use C++0x threads in my application instead of Boost threads. However, I'm not sure how to reimplement what I have with standard C++0x threads since they don't seem to have an interrupt() method. My current setup is: a master thread that manages work; several worker threads that carry out master's commands. Worke...

Microbenchmark showing process-switching faster than thread-switching; what's wrong?

I have two simple microbenchmarks trying to measure thread- and process-switching overheads, but the process-switching overhead is turning out to be lower than that of thread-switching, which is unexpected. The setup: 1.8GHz Core 2 Duo, 2GB RAM, Linux 2.6.32-21-generic x86_64 (Ubuntu 10.04). I'm getting: ~2.1-2.4us per process switch ~...

Structured Storage

Hi All, I have a file that is in structured storage format. I was wondering if this format be accessed concurrently by threads. Meaning have multiple threads read the different streams process it at once. The objective is to load the file faster. When i refer to a file i refer one that represents CAD information. Thank you. ...

python multithreading for dummies

trying to find a simple example that clearly shows a single task being divided for multi-threading. Quite frankly... many of the examples are overly sophisticated thus.... making the flow tougher to play with... anyone care to share their breakthrough sample or point to an example? As well, what is the best docs? many google lookup...

Thread-safe get (accessor method)

I'm currently using the following code for thread-safe access of a variable. int gnVariable; void getVariableValue(int *pnValue) { acquireLock(); //Acquires the protection mechanism *pnValue = gnVariable; releaseLock(); //Releasing the protection mechanism } I would like to change my API signature to a more user-friendly ...

Visual C++ CreateThread Parameter Problem

I have a class that contains a function that calls create thread, and needs to pass itself (this) as a parameter: DWORD threadId; HANDLE h = CreateThread( NULL, 0, runThread, this, 0, &threadId); My runThread definition is as follows: DWORD WINAPI runThread(LPVOID args) { Obj *t = (Obj*)args; t->funct(); return 0; } Unf...

Is RegSetValueEx thread safe?

I suspect that RegSetValueEx is thread safe, but would like some confirmation from the community. If called from multiple threads, will there be any side effects? The RegSetValueEx MSDN documentation doesn't mention thread safety at all. ...

threads running for a particular process in Linux

I want to know the threads running for a particular process in Linux?How can i know guys? I tried some commands but its not working......... ...

Can floating-point precision be thread-dependent?

I have a small 3D vector class in C# 3.0 based on struct that uses double as basic unit. An example: One vector's y-value is -20.0 straight I subtract a vector with an y-value of 10.094999999999965 The value for y I would expect is -30.094999999999963 (1) Instead I get -30.094999313354492 (2) When I'm doing ...