I use Python multithread to realize Quicksort.
Quicksort is implement in a function. It is a recursive function.
Each thread calls Quicksort to sort the array it has. Each thread has its own array that stores the numbers needs to be sorted.
If the array size is smaller (<10,000). It runs ok.
However, if the array size is larger, it shows the…
I use C++ to implement a thread class. My code shows in the following.
I have a problem about how to access thread data.
In the class Thread, I create a thread use pthread_create() function. then it calls EntryPoint() function to start thread created. In the Run function, I want to access the mask variable, it always shows segment fault.
So,…
I use c++ to implement a thread class. The code is in the following.
I initialize two objects, wish it will start two threads (I use pthread_self() to look the thread Id).
But the result shows that there is only one thread beside the main thread.
I am a bit confused...
class Thread {
public:
int mask;
pthread_t thread;
Thread( int );
…
This is a problem me and my team faces in almost all of the projects. Testing certain parts of the application with JUnit is not easy and you need to start early and to stick to it, but that's not the question I'm asking. The actual problem is that with n-Threads, locking, possible exceptions within the threads and shared objects the task of…
Hello,
I use netcat to run a simple server like this:
while true; do nc -l -p 2468 -e ./my_exe; done
This way, anyone is able to connect to my host on port 2468 and talk with "my_exe".
Unfortunately, if someone else wants to connect during an open session, it would get a "Connection refused" error, because netcat is no longer in listening…
I have global static variables in a C library, which generate exceptions in a multithread run. I need to make them safe in some way (i.e. - each thread should relate to a different instance of these variables). Any recommended methods?
10x
I have global static variables in a C library, which generate exceptions in a multithread run. I need to make them safe in some way (i.e., each thread should relate to a different instance of these variables). Any recommended methods?
What is the best approach to creating a simple multithread safe logging class? Is something like this sufficient?
public class Logging
{
public Logging()
{
}
public void WriteToLog(string message)
{
object locker = new object();
lock(locker)
{
StreamWriter SW;
…
I looking for software similar to JDownloader or PyLoad. JD is pretty good but use heavy Java and for now have very weak web interface. PyLoad is awesome, include simple but powerful web-UI but downloading 10 files (10 threads each, so summary it's 100 connections running at around 8MB/s all) consume a lot of cpu - it's whole core…
I'm trying to do multithread uploads, but get errors.
I guessed that maybe it's impossible to use multithreads with ftplib?
Here comes my code:
class myThread (threading.Thread):
def __init__(self, threadID, src, counter, image_name):
self.threadID = threadID
self.src = src
self.counter = counter
…
I'm trying to designing a class and I'm having issues with accessing some of the nested fields and I have some concerns with how multithread safe the whole design is. I would like to know if anyone has a better idea of how this should be designed or if any changes that should be made?
using System;
using System.Collections;
…
Hello
I want to use setitimer() (or alarm()) in multithreaded process in linux 2.6+ with NPTL-enabled libc. Which thread will receive sigalarm (SIGALRM) from kernel?
Thanks.
Hi.
I'm facing a dilemma (!).
In a first scenario, i implemented a solution that replicates data from one data base to another using SQLBulkCopy synchronously and i had no problem at all.
Now, using ThreadPool, i implemented the same in a assynchronously scenario, a thread per table, and all works fine, but past some time…
I've a code alike
void ExecuteTraced(Action a, string message)
{
TraceOpStart(message);
a();
TraceOpEnd(message);
}
The callback (a) could call ExecuteTraced again, and, in some cases, asynchronously (via ThreadPool, BeginInvoke, PLINQ etc, so I've no ability to explicitly mark operation scope). I want to trace…
I have a large number of files to process. I have written a script that get, sort and plot the datas I want. So far, so good. I have tested it and it gives the desired result.
Then I wanted to do this using multithreading. I have looked into the doc and examples on the internet, and using one thread in my program works fine.…
i want to make a console program to monitor a webpage's htmlsourcecode, because some of the page content are created by some javescript, so i have to use webbrowser control. like : View Generated Source (After AJAX/JavaScript) in C#
my code is below:
public class WebProcessor
{
public string GeneratedSource;
…
I have an application which downloads more than 4500 html pages from 62 target hosts using HttpClient (4.1.3 or 4.2-beta). It runs on Windows 7 64-bit. Processor - Core i7 2600K. Network bandwidth - 54 Mb/s.
At this moment it uses such parameters:
DefaultHttpClient and PoolingClientConnectionManager;
Also it…
I have a UIWebView in a viewcontroller, which has two methods as below. The question is if I pop out(tap back on navigation bar) this controller before the second thread is done, the app will crash after [super dealloc], because "Tried to obtain the web lock from a thread other than the main thread or the web…
I'm creating a WPF application that uses a custom object to populate all the controls. The constructor of that object is initiated by an EventHandler that waits for an API. The problem I'm having is when I try to access any information from that object using a button for example, it returns an error saying…
I have a program with several threads, one thread will change a global when it exits itself and the other thread will repeatedly poll the global. No any protection on the globals.
The program works fine on uni-processor. On dual core machine, it works for a while and then halt either on Sleep(0) or…
HELP please i have this code
import socket
from threading import *
import time
HOST = '' # Symbolic name meaning all available interfaces
PORT = 8888 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print ('Socket created')
s.bind((HOST, PORT))
print…
I have very bad perfomance of HttpWebRequest.GetResponse method when it is called from different thread for different URLs.
For example if we have one thread and execute url1 it requires 3sec.
If we ececute url1 and url2 in parallet it requires 10sec, first request ended after 8sec and second…
I'm trying to update my Silverlight 4 UI approx every 1/2 second with new data. I've hooked into a WCF service using net.tcp binding and issuing callbacks from the server. To make sure I get the data from the service as quickly as possible I've started up my proxy on a backround worker…
i'm doing something for fun, trying to learn multithreading
Problems passing array by reference to threads
but Arno pointed out that my threading via process.h wasn't going to be multi-threaded.
What I'm hoping to do is something where I have an array of 100 (or 10,000, doesn't really…