multithreading

How to create a thread?

Hello, The method below is what I want to be done in that thread: public void Startup(int port,string path) { Run(path); CRCCheck2(); CRCCheck1(); InitializeCodeCave((ushort)port); } I tried what I could find googling,but nothing worked public void Test(int port,string path) { ...

Windows Threading Wait Method

I'm creating a thread class to encapsulat the windows thread methods. I'm trying to create a method that makes the application wait for the thread to complete before it exits the application. If I use a while loop and boolean flag, it works but obviously it spikes my CPU use and its just not ideal. What ways would you use to wait for th...

thread performance on Linux vs. Solaris

This Linux Magazine article http://www.linux-mag.com/id/792 explains the difference in the way threads are implemented in Linux as compared to commercial Unixs such as Solaris. In summary, Linux uses a 1-to-1 mapping of user threads to kernel threads, while Solaris uses a many to many mapping. The article implies that this might give Sol...

Python Timeout

I've been looking all over the place for a good timeout script that can kill a thread if it's been active for more than X seconds, but all the examples I've seen have flaws that don't always stop the thread. Using thread.join(x) ends up defeating the purpose of it being a thread. The only decent example I've found is http://stackoverflo...

Threading multiple async calls (Silverlight)

Hi, Part of my Silverlight application requires data from three service requests. Up until now I've been chaining the requests so as one completes the other starts... until the end of the chain where I do what I need to do with the data. Now, I know thats not the best method(!). I've been looking at AutoResetEvent (link to MSDN example...

Writing to a textBox using two threads

Hello, I have some unsolved issue with threads. It's my first time doing it. I know how to use one thread to write in a textBox, but I have no idea how to use two of them to do the job. Anyone have a clue what do I have to do to be able to use two threads to write to the same textBox, but not in the same time. Thank you. ...

Thread Finished Event in Python

Hello, I have a PyQt program, in this program I start a new thread for drawing a complicated image. I want to know when the thread has finished so I can print the image on the form. The only obstacle I'm facing is that I need to invoke the method of drawing from inside the GUI thread, so I want a way to tell the GUI thread to do someth...

Is Sun's Thread join method broken?

By both running test programs and looking at source code, it is clear that the method, as implemented by Sun, does not simply yield time to the specified thread, but actually it first attempts to obtain a monitor on the thread object. Specifically, the method is implemented as "synchronized." Note that the wait and notify methods also ...

How do I compile Perl 5.10 with thread support under FreeBSD 7.1?

I'm trying to compile Perl 5.10 on my FreeBSD 7.1 (BSD) server but when I run the Configure script and answer the questions I get the following error: ...POSTIX threads should be supported by FreeBSD 7.1 ... but your system is missing the shared libc_r. Googling for the answer came up with installing gethostnamadr.c which is fine exce...

How to block a timer while processing the elapsed event?

I have a timer that needs to not process its elapsed event handler at the same time. But processing one Elapsed event may interfere with others. I implemented the below solution, but something feels wrong; it seems like either I should be using the timer differently or using another object within the threading space. The timer seemed ...

using threads and pyGST in a wx python app

OK, so I am writing an app, which plays music with the pyGST bindings. This requires the use of threads to handle playback. The bindings library handles most of the thread control for me, which is nice(and what I was looking for in them). Now, I don't have a full grasp on this concept, so I would be eager for some references. But the w...

Distributed computing vs threads

How similar is distributed computing and threading? I've found two papers coming to quite opposite conclusions: "Multi-Threading is Easier Than Networking. How threading is easy and similar to network code" http://software.intel.com/file/14723 (this gives me an impression that they're so similar that after encapsulation these two appr...

How can a method know if it's running on the UI thread?

I have a simple question, but I'm about 80% sure that the answer to the question will be accompanied by "you're doing it wrong," so I'm going to ask the not-simple question too. The simple question: I have a public method of a public class. I want it to throw an exception if it's called on the UI thread. How can I do this? The much-...

Cost/benefit of multi-threaded text processing

I am working on a real-time syntax highlighter for the iPhone and I have created a custom UIView that takes a string, parses it and then highlights it in its drawRect: method. I've also implemented a blinking cursor. However, it is starting to get a little slow and I think that when I implement multi-line processing and chunk-processing,...

What is the best way to link your application to Swing GUI?

If I have Swing GUI class and application, how should I manage communication between these objects? Should I pass GUI object link to app or app link to GUI? Example: public class App{ public App() { GUI gui = new GUI(this) } } or public GUI{ public GUI() { App gui = new App(this) } } ...

When and how should I use a ThreadLocal variable?

When should I use a ThreadLocal variable? How is it used? ...

Using multi-threading to speed up .NET reflection

My PC have a dual core CPU and I was wondering - would it be possible to reduce .NET reflection times by two, if I start processing in a two thread. By "processing" I have meant the following: 1.loading the assembly 2.getting all types out of it (.GetTypes()) 3.processing these types 4.querying these types for methods etc. If yes - w...

How can I set a timeout around some code in java on the main thread?

I'm looking for functionality in java identical to this in ruby: SystemTimer.timeout_after(30.seconds) do do something end i could achieve this by forking a thread and then killing it after a while, but is there a simpler way? ...

Any suggestions for a program or small project to learn about concurrency in Java?

I'm aiming to learn about concurrency in Java. Currently my state of knowledge is poor. I'm pretty sure I know what "volatile" means. I sort of know what "synchronized" means. Sometimes. I've never written code that starts threads or manages them. Outside of this issue, I feel confident and at home working in Java. I'm looking for...

Operations from atomic.h seem to be non-atomic

The following code produces random values for both n and v. It's not surprising that n is random without being properly protected. But it is supposed that v should finally be 0. Is there anything wrong in my code? Or could anyone explain this for me? Thanks. I'm working on a 4-core server of x86 architecture. The uname is as follows. L...