multithreading

Boost Thread ID Invalid

Hello to all, i have bunch of question regarding to boost thread ? How to initialize the boost thread ID with the thread constructor? Why the thread id becomes invalid after called join() function ? As usual, a class member function is copy to thread internal storage in order to execute the member function but i found out that someo...

How to check if background thread is still running (on IIS 7.0)

Context: .Net 3.5, ASP.Net MVC 2.0, on shared IIS 7.0 (integrated mode). I plan to use cache-event trick to create a background "process" that shall download pages over the internet and update local database. I plan to create a background thread, and then check if that thread is still alive (using cache-event trick). If thread dies, r...

Objective C - Single Background Thread

I want to run a single background thread for an iPhone application which is available in background all the time and gets executed when specific event fires and go to wait for specific event to fire to start its execution again. During the execution of thread if specific event is fired again then thread should restart its work. I am wo...

How to handle ObservableCollection<> result from a parallelized Task in MVVM?

Hi. I am gathering data in a separate Task and I want to data bind the result to a GUI component using an ObservableCollection<>. So my code goes something like this: private ObservableCollection<MyItem> _items; public ObservableCollection<MyItem> Items { get { return _items; } set { if (_items.Equals(value)) { retur...

Multithreading on Static Methods/Classes

Do We really need Locking for Static methods(Static Class) when the methods are heavily used by threads? Is it required when Static methods are using resources like SQL Queries/StoredProcedures ? Thanks Pankaj ...

Why would InvokeRequired=False via a Delegate.BeginInvoke?

For what reasons would this.InvokeRequired equal False within InitUIState(), as this new thread is being created via a delegate? My problem is that my label is never being set and this.BeginInvoke() is never executing, I imagine it's due to the fact InvokeRequired = False. private delegate void BackgroundOperationDelegate(ViewMode ...

Time of thread vs process in windows?

I need to chose between a process with 2 threads or a 2 processes with one thread on windows. I am intresting in the time slice. Windows running threads so context switch will be in either case. What I want to know if the time it runs each of the thread in the 2 cases will be the same? Thanks. ...

TThread.Execute is not called as expected

I am trying to display an activity indicating overlay (a spinning circle of dots) during a lengthy operation in my application. For this, i created a borderless transparent form with a TImage and an Imagelist, which i sought to update in a thread during the time the main thread is busy. The problem i encountered is that the lengthy oper...

MultithreadingMultiprocessing with STOP and Continue Signals

Hello ALL, I am working on a project, where i need to get native stack of the Java Application. i am able to achieve this partially. thanks to ptrace/multiprocessing and signals. on Linux normal java application has minimum 14 number of threads. out of these 14 i am interested in only main thread of which i have to get native stack. co...

Static Variables Behaviour in a Java Servlet

Hi, I am developing a java servlet that while running, starts different objects methods in new threads. Those threads should access a variable that describes the specific servlet instance, say jobId. For this reason, i declared the jobId variable as static. The servlet constructor is calculating this value for each servlet instance (call...

C#: UDP Listener Thread

Hi, i found articles to that topic, but they dont solve my problem... I want to use UDP-Sockets for my XNA-Networkgame. And now i am trying to code a reliable Listenerthread, but there are some Problems. If i use socket.Receive it will wait until a packet. This is fine for my Listenerthread. My thread has a while-loop like this: while...

Why aren't my scala futures more efficient ?

I'm running this scala code on a 32-bit quad-core Core2 system: def job(i:Int,s:Int):Long = { val r=(i to 500000000 by s).map(_.toLong).foldLeft(0L)(_+_) println("Job "+i+" done") r } import scala.actors.Future import scala.actors.Futures._ val JOBS=4 val jobs=(0 until JOBS).toList.map(i=>future {job(i,JOBS)}) println("Running....

How can I show a list of every thread running spawned by setTimeout/setInterval

Hi, I want to do this either by pure javascript or any sort of console in a browser or whatever. Is it possible? Thanks Further explanations: I want to debug a library that does animations. I want to know if there's multiple timers created if there are multiple objects being animated. ...

What is triple check locking pattern

Reference:- "Modern C++ Design: Generic Programming and Design Patterns Applied" by Andrei Alexandrescu Chapter 6 Implementing Singletons. Even if you put volatile then also it is not guaranteed to make Double Check locking pattern safe and portable.Why it is so? If some one can put any good link that explains what is relaxed memory ...

Delphi thread exception mechanism

Hello everybody, i have a dilema on how threads work in delphi, and why at a moment when a thread should raise an exception, the exception is not showed. bellow is the code with comments, maybe somebody cand explain to me how that thread, or delphi, is managing access violations //thread code unit Unit2; interface uses Classes, ...

Get notifications of new threads / deleted threads under Windows

When you create a DLL you can get notifications about new threads / exiting threads in the DllMain function (DLL_THREAD_ATTACH/DLL_THREAD_DETACH). Is there a way to get these or equivalent notifications from Windows within an (non managed) Executable? ...

Update a ObservableCollection with a background worker in mvvm

Ok, I recently implemented a background worker to perform saves and loading of data. However getting this to work on a save command has proved difficult. Basically my Save command generates an event that notifies a collection view model that an Item has been added and that It should add it to its own observeablecollection. At this poi...

How To Prevent WPF DataGrid From De-Selecting SelectedItem When Items Updated?

My scenario: I have a background thread that polls for changes and periodically updates a WPF DataGrid's ObservableCollection (MVVM-style). The user can click on a row in the DataGrid and bring up the "details" of that row in an adjacent UserControl on the same main view. When the background thread has updates, it cycles through the ob...

How should i write producer /consumer code in C#?

I have 1 thread streaming data and a 2nd (the threadpool) processing the data. The data processing takes around 100ms so I use to second thread so not to hold up the 1st thread. While the 2nd thread is processing the data the 1st thread adds the data to a dictionary cache then when the 2nd thread is finished it processes the cached valu...

Guidance on creating a server that has a group of threads to process requests

Say I am 1000 pop emails that I have to pull emails from. I want to create a service, that utilizes muliple threads so I can pull email from multiple pop3 servers at the same time (as oppose to a serialized process). How would I go about doing this? ...