multithreading

Faster fundamental datastructures on multicore machines?

I've been pondering this question for a while: Can you build a faster fundamental datastructure (i.e. linked list, hashtable, set, skiplist, bloom filter, red-black tree, etc.) on a multicore machine, by taking advantage of the fact that you've got more than one CPU? I did some preliminary experimenting with pthreads, and found that pt...

Problem with threads.

*I'm using Java. I have this thread, agent, that explores a room to determine its size and clean it if it's dirty. Then I have the interface, which draws the agent as it explores the environment. Agent is subclassed from Thread, and Java takes care of managing the threads. All I do is create the thread and say object.start(). This work...

What is the Best Practice for converting a vb6 standard exe to a activex exe?

Hi guys, i have a legacy massive vb6 editor with plenty of 3rd party libraries and controls and recently there is a need to set it up to make it multi thread so i can run a few other forms independently from the main editor form. Basically there's minimum communication between these other forms and the main editor except for running the ...

How do I get my Threads to not block one another?

I have 2 Threads, one that's polling a mailbox for messages then sleeping while (!quit) and another that's supposed to change the quit flag should the user enter 'Q'. It seems that the scanning Thread blocks the other Thread from executing until there's some input (usually 2 lines). I've tried changing the priority of the Threads and the...

How do I stop a windows service application from a thread?

I have a windows service that starts a thread in the OnStart method. Basically I want to be able to stop the service if something goes really wrong (like an unhandled exception). Currently I'm using ServiceBase.Stop() but that involves having a ServiceBase instance somewhere visible to the thread, which in turn involves having my insta...

libspe vs. libspe2? What's the difference?

I've been doing some experiments with the Cell processor in a PS3 that I have sitting around and I've run across an issue. It appears that there are two versions of the main SPE management library, libspe and libspe2. What is the difference between them? From what I can tell the main difference is that in libspe they rolled their own thr...

Objective-C properties: atomic vs nonatomic

What do atomic and nonatomic mean in property declarations? @property(nonatomic, retain) UITextField *userName; @property(atomic, retain) UITextField *userName; @property(retain) UITextField *userName; What is the functional difference between these 3? ...

In what languages/platforms is Invoke for GUI operations required?

I understand that in .NET, one needs to use Control.Invoke(delegate) to perform operations on a control. This lead me to wondering in which environments Invoke is actually required. As far as i know, it was not required in older versions of, say, Visual Basic and Pascal. In particular, what is the status of Java (possibly version-depende...

Best Practice for watching an upload folder?

Ok I've got a bit of an interesting problem on my hands. Here's a bit of background: I'm writing a media library service implementation that will serve URLs to a front end flash player. The client wants to be able to push content into the service by uploading files with some metadata into an FTP folder - I have control of the metadata s...

In c# does a locked object stay locked if an exception occurs inside it?

In a c# threading app, if I were to lock an object, let us say a queue, and if an exception occurs, will the object stay locked? Here is the pseudo-code: int ii; lock(MyQueue) { MyClass LclClass = (MyClass)MyQueue.Dequeue(); try { ii = int.parse(LclClass.SomeString); } catch { MessageBox.Show("Error parsing...

Is it practically safe to write static data from multiple threads

I have some status data that I want to cache from a database. Any of several threads may modify the status data. After the data is modified it will be written to the database. The database writes will always be done in series by the underlying database access layer which queues database operations in a different process so I cam not con...

Silverlight: Threads / Delayed Actions / Asynchronous invocations/events

Hi, I've got the following scenario: when a user moves the mouse out of a popup, I want an animation to happen, and five seconds later, I want to remove a PopUp. This is the code I expected to do this with is: private bool leftPopup = false; public void AnimatePopupOut(object sender, MouseEventArgs e) { myAnim.Begin(); (new Thre...

Making sure OnPropertyChanged() is called on UI thread in MVVM WPF app

In a WPF app that I'm writing using the MVVM pattern, I have a background process that doing it's thing, but need to get status updates from it out to the UI. I'm using the MVVM pattern, so my ViewModel knows virtually nothing of the view (UI) that is presenting the model to the user. Say I have the following method in my ViewModel: p...

Can a standard thread be reused for the Thread Pool?

I'm having some weird behavior in an application which is puzzling me. I create a thread, let's call it worker, which is responsible for handling communication requests. Clients write on a pipe while the thread consumes the requests and send messages. Now, the main loop of the thread has something like this: lock(this) { object_id =...

Multithreading in PHP

I recently read about http://php.net/pcntl and was woundering how good that functions works and if it would be smart to use multithreading in PHP since it isn't a core function of PHP. I would want to trigger events that don't require feedback through it like fireing a cronjob execution manually. All of it is supposed to run in a web a...

How to kill a MFC Thread?

I spawn a thread using AfxBeginThread which is just an infinite while loop: UINT CMyClass::ThreadProc( LPVOID param ) { while (TRUE) { // do stuff } return 1; } How do I kill off this thread in my class destructor? I think something like UINT CMyClass::ThreadProc( LPVOID param ) { while (m_bKillThread) { // d...

How to change Listener Thread Priority in Indy

Hi all! I use the TIdCmdTCPServer component of Indy 10 to realize my client-server application. The problem is that the request from clients can be fairly complicated and that the GUI part of my server application immediately loses responsiveness. From the Indy Documentation i got that Indy Creates and starts listener threads for B...

Thread.getId() global uniqueness question

If multiple Java applications are running on a system, is each Thread ID unique relative to all other Java threads, regardless of what application they are running in? Java applications are supposed to be sand-boxed relative to other Java applications so I thought it might be possible for Thread IDs to collide. If the Thread IDs are un...

How to write a .NET Stream to two other Streams simultaneously without buffers?

In my previous question, someone has commented that write a .NET Stream to two another Streams simultaneously is possible. I only could find one way but using a temporary variable (buffer) that would store the contents (fully or partialy at once) of the input Stream. There is any way to do that without using buffers? There is any way t...

In Python what is the preferred way to create and manage threads?

Python provides several methods to create threads. Which provides the best API and the most control? Thanks. ...