multithreading

How do I delete a entries from one properties file after some time interval?

i have one property file which contains some records so i need to delete the records after some time interval let's take 2 minute or 3 minutes, so how can i do that one? ...

Number of threads used by Intel TBB

How does Intel TBB choose the number of threads to used for a parallel section? Is there some kind of specification available? ...

Multithreading or observer pattern when waiting for dns lookup?

Hi, I'm designing a system in java which utilizes a dns lookup class. My question is, when calling the class's dnsLookup(), whether to do it in a new thread or use the observer pattern and let the dns class tell me when it's done. This isn't a problem as long as the lookup returns a value almost instantly but when it takes a few seco...

Should I use a background thread for my UI actions?

Background I've got an NSOutlineView that shows TrainingGroup entities. Each TrainingGroup represents a folder on the local machine. The NSOutlineView is bound to an NSTreeController with a fetch predicate of IsTrained == 0 Each TrainingGroup can be assigned to a project. Each TrainingGroup has many TrainingEntries that show a time wor...

Python threading ignores KeyboardInterrupt exception

I'm running this my simple code: import threading, time class reqthread ( threading.Thread ): def __init__ (self): threading.Thread.__init__(self) def run ( self ): for i in range(0,10): time.sleep(1) print '.' try: thread=reqthread() thread.start() except (KeyboardInterrupt, SystemExit): print '\n! Rece...

Unable to close a stream opened with pycurl

I am working on a client for a web service using pycurl. The client opens a connection to a stream service and spawns it into a separate thread. Here's a stripped down version of how the connection is set up: def _setup_connection(self): self.conn = pycurl.Curl() self.conn.setopt(pycurl.URL, FILTER_URL) self.conn.setopt(py...

Correct thread destroy

Hello At my form I create TFrame at runtime. At this frame I create background thread with executes commands in endless loop. But when I destroy this frame I should destroy this thread. I try thread.Suspend; thread.Terminate; FreeAndNil(thread); but get AV and ThreadError. How should i destroy thread? ...

Multithreading with the WPF DataGrid?

I currently have a WPF DataGrid binded to a DataSet via the DataGrid's ItemsSource property in my program. With my current setup, I am having load-time issues that cause the GUI to lock up. Is it possible to multithread the loading of the DataGrid so that it will populate the rows as they are loaded instead of loading all the rows and th...

destroying a singleton object

What is the best way to destroy a singleton object? case A: Single threaded Environment case B: Multi Threaded Environment Sample snippets(if any) will be really helpful. [EDIT] I don't have a specific use case I am just trying to understand that IF AT ALL the singleton has to be used how to destroy it correctly. As i understand...

WPF Datagrid update from background thread

I have a WPF Datagrid with the .ItemSource set to a Datatable. In a background thread, a new Datatable is generated, and needs to be added to the binded Datatable. When i do CurrentTable.Merge(NewTable) from the UI thread, the whole UI freezes for a couple of seconds (since there are so many rows to be added). When I do CurrentTable.Me...

Stopping individual threads

Using the pthread library in C, is it possible to send a SIGSTOP signal to an individual thread? I want to ensure that even though I create N threads in a loop, all should start executing only when all of them have been created. I ask because the man page for pthread_kill() mentions: Signal dispositions are process-wide: if ...

C#: Parallel.ForEach() vs. foreach(IEnumerable<T>.AsParallel())

Erg, I'm trying to find these two methods in the BCL using Reflector, but can't locate them. What's the difference between these two snippets? A: IEnumerable<string> items = ... Parallel.ForEach(items, item => { ... }); B: IEnumerable<string> items = ... foreach (var item in items.AsParallel()) { ... } Are there different ...

How can you visually represent which threads lock on which objects in Java while debugging?

Using the following textbook thread wait/notify example, is there a tool (Eclipse plugin?) that tracks which thread locks on which object while stepping through and debugging? A tool that visually displays the connections in some way would be ideal if possible. public class ThreadA { public static void main(String[] args) { ...

Form is not updating, after custom class event is fired.

I'm having an issue where my main form isn't updating even though I see the event fire off. Let me explain the situation and share some of my code which I'm sure will be horrible since I'm an amateur. I created a class to take in the settings for running a process in the background. I add some custom events in that class so I could us...

C#: Adding context to Parallel.ForEach() in ASP.NET

I have a static class with a static get property, and in this property, I do this: // property body { // HttpContext.Current is NOT null ... Parallel.ForEach(files, file => { // HttpContext.Current is null var promo = new Promotion(); ... }); ... // HttpContext.Current is NOT null } ...

Creating a thread to asynchronously download xml for usage in UI elements

I'm making an application that grabs an RSSFeed from one location, parses it, and displays the items in a rich ListView. I've got it working synchronously, but it hangs on the initial download. I used ImageDownloader from the Google blog to asynchronously grab images to populate the ListView, but how do I go about threading the download ...

Long term operation progress window

Hi, in WPF application I load a list of business objects by WCF to a listbox. I want to load it in another thread and display a progressbar window. But how? I need to call WCF service in the second thread and return its return value to the first (UI) thread. And this is the point I don't know. How to return? Or what should be the corre...

How do I get all instances of VLC on dbus quickly?

basically the problem is, that the only way to get all instances of VLC is to search all non-named instances for the org.freedesktop.MediaPlayer identity function and call it. (alternatively I could use the introspection API, but this wouldn't seem to solve my problem) Unfortunately many programs upon having sent a dbus call, simply do ...

Can read / write be performed parallely on a JSSE based SSL Socket in Java?

The most commonly used 'C' Implementation of SSL (OpenSSL) doesn't support parallely operations on it's SSL Session. (i.e. You cannot do a SSL_read & SSL_write) parallely for the same session. Does the Java bases SSL, JSSE support this feature? i.e. For the same SSL Session created using JSSE, can I do read and write parallely on diffe...

Thread Monitoring C#

Hi, In my application I have 6 arrays which represents 6 jobs that my application performs.Each job is basically interacting with database and filling each element of array. What I did is create 6 threads and make the 6 arrays global so that the threads can fill them.I have also created a array of 6 bool elements(ThreadsAlive).When a thr...