I am doing some expensive caluations right now. It is one programm, which I run several instances of at the same time. I am running them under linux on a machine with 4 cpus with 6 cores each. The cpus are Intel Xeon X5660, which support hyper thearting. (That's some insane hardware, huh?) Right now I am running 24 processes at once. Wou...
Is there a Pool class for worker threads, similar to the multiprocessing module's Pool class?
I like for example the easy way to parallelize a map function
def long_running_func(p):
c_func_no_gil(p)
p = multiprocessing.Pool(4)
xs = p.map(long_running_func, range(100))
however I would like to do it without the overhead of creatin...
I'm writing a multithreaded website uptime checker in perl, and here is the basic code so far (includes only threading part):
#!/usr/bin/perl
use LWP::UserAgent;
use Getopt::Std;
use threads;
use threads::shared;
my $maxthreads :shared = 50;
my $threads :shared = 0;
print "Website Uptime Checker\n";
my $infilename = $ARGV[0];
cho...
I have a background thread that generates a series of BitmapImage objects. Each time the background thread finishes generating a bitmap, I would like to show this bitmap to the user. The problem is figuring out how to pass the BitmapImage from the background thread to the UI thread.
This is an MVVM project, so my view has an Image eleme...
I'm using Valgrind --tool=drd to check my application that uses Boost::thread.
Basically, the application populates a set of "Book" values with "Kehai" values based on inputs through a socket connection.
On a seperate thread, a user can connect and get the books send to them.
Its fairly simple, so i figured using a boost::mutex::scope...
Hi,
Thread class has run method to implement the business logic that could be executed in parallel.But I want implement different business logics in a single run method and to run simultaneously.How to get this feature.
thanks
...
Hello,
The code below is meant to take an arraylist of product objects as an input, spun thread for each product(and add the product to the arraylist 'products'), check product image(product.imageURL) availability, remove the products without images(remove the product from the arraylist 'products'), and return an arraylist of products w...
Hi, I am writing a program to crawl the websites. The crawl function is a recursive one and may consume more time to complete, So I used Multi Threading to perform the crawl for multiple websites.
What exactly I need is, after completion crawling one website it call next one (which should be in Queqe) instead multiple websites crawling ...
Hi,
I'm looking for some advice on the best approach to synchronising access to properties of an object in C++. The application has an internal cache of objects which have 10 properties. These objects are to be requested in sets which can then have their properties modified and be re-saved. They can be accessed by 2-4 threads at any giv...
Hi,
I'm working on a media player and am able to load in a single .wav and play it. As seen in the code below.
foo = wx.FileDialog(self, message="Open a .wav file...", defaultDir=os.getcwd(), defaultFile="", style=wx.FD_MULTIPLE)
foo.ShowModal()
queue = foo.GetPaths()
self.playing_thread = threading.Thread(target=self.playFi...
Any good source/links or concise explaination about it?
Thanks a lot!
...
In my Application I have a static method that is called from multiple threads at the same time. Is there any danger of my data being mixed up?
In my first attempt the method was not static and I was creating multiple instance of the class. In that case my data got mixed up somehow. I am not sure how this happens because it only happens ...
Hi,
I have a background worker running to copy a huge file (several GBs) and I'd like to know how to cancel the process in the middle of the copy. I can check CancellationPending property before the copy but don't know how to do it when copy is already in progress.
if (worker.CancellationPending) // check cancellation before copy
{ ...
I occasionally use a volatile instance variable in cases where I have two threads reading from / writing to it and don't want the overhead (or potential deadlock risk) of taking out a lock; for example a timer thread periodically updating an int ID that is exposed as a getter on some class:
public class MyClass {
private volatile int ...
I have a design question. I want some feedback to know if a ThreadPool is appropriate for the client program I am writing.
I am having a client running as a service processing database records. Each of these records contains connection information to external FTP sites [basically it is a queue of files to transfer]. A lot of them are...
Currently I am loading my supported products from a plist and after that I send a SKProductsRequest to guarantee that my SKProducts are still valid.
So I set up the request, start it and get the response in:
(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
Now, so far all functions...
Hey guys
i just have two questions about two methods used in many controllers/servlets in my app:
1-what is the difference between calling a static method in a util class or a non static method (like methods dealing with dates i.e getting current time,converting between timezones), which is better ?
2-what is the difference between call...
I have a static class with a few methods that just take in a byte array, parses it, and returns a structure. I need to call these methods from many separate threads. Do I need a lock() or some kind of thread-safety within the methods? I can't get my head around it.
...
Hi. I'm building an app that uses and scanner API and a image to other format converter. I have a method (actually a click event) that do this:
private void ButtonScanAndParse_Click(object sender, EventArgs e)
{
short scan_result = scanner_api.Scan();
if (scan_result == 1)
parse_api.Parse(); // This will check for...
Hi,
I am creating some multi-threaded code, and I have created a JobDispatcher class that creates threads. I want this object to handle any unhandled exceptions in the worker threads, and so I am using
Thread.setUncaughtExceptionHandler(this);
Now, I would like to test this functionality - how can I generate an unhandled exception in...