multithreading

Multi-part question about multi-threading, locks and multi-core processors (multi ^ 3)

I have a program with two methods. The first method takes two arrays as parameters, and performs an operation in which values from one array are conditionally written into the other, like so: void Blend(int[] dest, int[] src, int offset) { for (int i = 0; i < src.Length; i++) { int rdr = dest[i + offset]; dest[i...

total number of threads on nvidia Tesla

What is the total number of threads that can run concurrently on an nvidia Tesla, say S1070. ...

NInject and thread-safety

I am having problems with the following class in a multi-threaded environment: public class Foo { [Inject] public IBar InjectedBar { get; set; } public bool NonInjectedProp { get; set; } public void DoSomething() { /* The following line is causing a null-reference exception */ InjectedBar.DoSomething...

How to implement cancellable worker thread

Hi, I'm trying to implement a cancellable worker thread using the new threading constructs in System.Threading.Tasks namespace. So far I have have come up with this implementation: public sealed class Scheduler { private CancellationTokenSource _cancellationTokenSource; public System.Threading.Tasks.Task Worker { get; private s...

Is it not possible to show a FolderBrowserDialog from a non-UI thread?

I'm facing problem in showing FolderBrowserDialog instance created and called from a non-UI thread. It doesn't get renders properly. Being more specific, it doesn't shows the folder tree but displays only the Make New Folder OK and Cancel ...

Are multiple DAOs with jdbctemplate constructor injection a multi-threading risk?

I've got a large multi-threaded webapp in which I am passing in jdbcTemplates into DAO classes via constructor injection. Is this a multi-threading risk? Should I be passing in just the datasource instead? ...

Right way to have a thread in parallel to django project on wsgi.

Hi guys. I'm writing a django project, and I need to have a parallel thread which performs certain tasks. The project will be deployed in Apache2.2 with mod_wsgi. Actually my implementation consists on a thread with a while True - Sleep which is called from my django.wsgi file. Is this implementation correct? Two problems raises: do...

Socket in multiple threads

I have a project where Thread A calls Accept(...) on some socket, then it passes it to another thread, which does receive on the socket and then closes the socket. The object on which accept was called is never closed in Thread A. Is that safe? What happens to that object in Thread A? ...

iphone threading question - looping?

i want to have a background thread in my app that changes an image every 5 seconds for as long as the app is being run. Can someone point me in the direction of how this works? I am new to threads. ...

optimistic lock-free FIFO queues impl?

is there any C++ implementation (source codes) of "optmistic approach to lock-free FIFO queues" algorithm? ...

How to end a thread in java?

hi all, I have 2 pools of threads ioThreads = (ThreadPoolExecutor)Executors.newCachedThreadPool(); cpuThreads = (ThreadPoolExecutor)Executors.newFixedThreadPool(numCpus); I have a simple web crawler that I want to create an iothread, pass it a url, it will then fetch the url and pass the contents over to a cpuThread to be processed ...

Thread exception when loading 3 instance of a class with worker thread connecting to a legacy system via a third party app

We have a composite wpf solution which use MVVM. there is a view class, in its code behind, we use a new worker thread to connect to a legacy system and load it into WindowsFormHost in xaml file using a third party app. When user logon the solution, it tries to load three instances of view class on three tabs. sometimes we get "Windows ...

How to catch exception in the main thread if the exception occurs in the secondary thread?

How to catch exception in the main thread if the exception occurs in the secondary thread? The code snippet for the scenario is given below: private void button1_Click(object sender, EventArgs e) { try { Thread th1 = new Thread(new ThreadStart(Test)); th1.Start(); } catch (Exception) {...

Not able to kill bad kernel running on NVIDIA GPU

Hi, I am in a real fix. Please help. Its urgent. I have a host process that spawns multiple host(CPU) threads (pthreads). These threads in turn call the CUDA kernel. These CUDA kernels are written by external users. So it might be bad kernels that enter infinite loop. In order to overcome this I have put a time-out of 2 mins that will ...

Sync between local service with a thread and an activity

Hello all, I'm trying to think of a way on how to sync in between a local service and the main activity. The local service has, A thread with a socket connection that could receive data at any time. A list/array with data. At any time the socket could receive data and add it to the list. The activity needs to display this data. So...

Django Thread-Safety for templatetags

Hi, I am coming here, because I have a question about Django and Thread. I read the documentation http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#template-tag-thread-safety and I would like to now if the next code could be impacted also, at the rendering context. class ChatterCountNode(NodeBase): def __init__(self,...

WCF threading - non-responsive UI

Hi everyone. I'm trying to configure some WCF stuff. Currently, I have a server which allows remote users to download files, and client. In the server, I use a ServiceHost class. I assume it should be running on a separate thread, however, the server UI (WinForms) becomes locked when someone downloads a file. Is there a way to manage th...

Please suggest good book/website to for Threads and Concurrency?

I have gone through Head First Java and some other sites but I couldn't find complete stuff related to Threads and additional concurrency packages at one place. Please suggest a book/website which covers complete Threads with more details like Synchronize and locking of objects More detailed about volatile Visibility issues in Threads...

Serialized task distribution: use thread or epoll?

Now I'm in such a situation that there is a group of predefined tasks for multiple clients to do(any client can take any task). When a client connects to the server, server choose a task from the uncompleted tasks and send it to the client --- job on the server side is quite easy. It takes a while for the client to finish the task and se...

Threads sharing Stack locations?

Hi there, I did a search but couldn't find anything. I was reading a paper that mentions thread sharing stack locations.... I wonder how and why'd that be needed. Any examples would be highly appreciated. Many thanks. ...