multithreading

signal qt from a non-qt thread, QueuedConnection

hello, I am signaling my Qt GUI thread from a boost::thread, and I am using a Qt::QueuedConnection, connect(src, SIGNAL(signal-signature), dest, SLOT(slot-signature), Qt::QueuedConnection); and still, when I emit the signal my slot does not get called. edit: I found the problem, it seems that I was connecting the signal later then ...

UdpClient receiving and sending at the same time

Hello, I am maintaining other's code and its using the class UdpClient. The code declares one instance of UdpClient and receives data continuously using the UdpClient.Receive(). When data is received, it is processed in another thread and the UdpClient calls Receive() again. At the same time when the data is processed the same client ...

Why is run() not immediately called when start() called on a thread object in java

Or is it? I have a thread object from: Thread myThread = new Thread(pObject); Where pObject is an object of a class implementing the Runnable interface and then I have the start method called on the thread object like so: myThread.start(); Now, my understanding is that when start() is called, the JVM implicitly (and immediately)...

Java - Multithreading !

What does phrase "synchronization with main memory" mean? ...

In .NET is there a thread scheduler for long running threads?

Our scenario is a network scanner. It connects to a set of hosts and scans them in parallel for a while using low priority background threads. I want to be able to schedule lots of work but only have any given say ten or whatever number of hosts scanned in parallel. Even if I create my own threads, the many callbacks and other asynchr...

Synchronizing thread communication?

Just for the heck of it I'm trying to emulate how JRuby generators work using threads in C#. Also, I'm fully aware that C# has built in support for yield return, I'm just toying around a bit. I guess it's some sort of poor mans coroutines by keeping multiple callstacks alive using threads. (even though none of the callstacks should exe...

What about race condition in multithreaded reading?

Hi, According to an article on IBM.com, "a race condition is a situation in which two or more threads or processes are reading or writing some shared data, and the final result depends on the timing of how the threads are scheduled. Race conditions can lead to unpredictable results and subtle program bugs." . Although the article concern...

How to send Event signal through Processes - C

Hello all! I have an application consisting of two windows, one communicates to the other and sends it a struct constaining two integers (In this case two rolls of a dice). I will be using events for the following circumstances: Process a sends data to process b, process b displays data Process a closes, in turn closing process b Pro...

ReaderWriterLockSlim and Pulse/Wait

Is there an equivalent of Monitor.Pulse and Monitor.Wait that I can use in conjunction with a ReaderWriterLockSlim? I have a class where I've encapsulated multi-threaded access to an underlying queue. To enqueue something, I acquire a lock that protects the underlying queue (and a couple of other objects) then add the item and Monitor.P...

Understanding Thread/BeginInvoke? [beginner]

Consider the code: class Work { public void DoStuff(string s) { Console.WriteLine(s); // .. whatever } } class Master { private readonly Work work = new Work(); public void Execute() { string hello = "hello"; // (1) is this an ugly hack ? var thread1 = new Thread(new Para...

AppDomain.CurrentDomain.DomainUnload not be raised in Console app

I have an assembly that when accessed spins up a single thread to process items placed on a queue. In that assembly I attach a handler to the DomainUnload event: AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload); That handler joins the thread to the main thread so that all items on the queue can compl...

Spawning worker threads

In C#, How would one go about spawning multiple threads and then sequentially adding results to a list before returning the entire result set? What are some best practices? I'm so far using an ManualResetEvent to signal when the last element has been processed by a thread. But when it returns, I need to have them consolidate the resu...

C# - ThreadPool.QueueUserWorkItem() Requirements

I have a windows service that has a lot of work to do simultaneously. I've looked into threading and found the ThreadPool class. I'm currently stuck, it doesn't seem to have any effect, it's like whatever I'm queuing is never run or called. In the service's OnStart() event I create a thread like this: Thread mainThread = new Thread(Rece...

Line of code doesn't follow sequential execution

Hi, I'm having a problem with a code that doesnt follow sequential execution although I'm not using threading. My code calls one function and when I'm debugging inside the function, it returns to the line of code following the function call although the function hasnt finished executing, I have no idea why this would happen, any ideas? t...

Are LinkedBlockingQueue's insert and remove methods thread safe?

I'm using LinkedBlockingQueue between two different threads. One thread adds data via add, while the other thread receives data via take. My question is, do I need to synchronize access to add and take. Is LinkedBlockingQueue's insert and remove methods thread safe? ...

Question about how to implement a c# host application with a plugin-like architecture

I want to have an application that works as a Host to many other small applications. Each one of those applications should work as kind of plugin to this main application. I call them plugins not in the sense they add something to the main application, but because they can only work with this Host application as they depend on some of it...

How to use SerialPort in .Net by using DataReceived event?

I know the DataReceived event is fired on a background thread. How do I tell the GUI thread to show the data in the event handler? ...

Thread signaling basics

Hello! I know C# , but I am a total newbie regarding threading and I am having trouble to understand some basic (I think) concepts like signaling. I spent some time looking for some examples, even here, without luck. Maybe some examples or a real simple scenario would be great to understand it. Thanks a lot in advance. ...

how to make a thread of never stop, and write something to database every 10 second..

i using gae and django this is my code: class LogText(db.Model): content = db.StringProperty(multiline=True) class MyThread(threading.Thread): def __init__(self,threadname): threading.Thread.__init__(self, name=threadname) def run(self,request): log=LogText() log.content=request.POST.get('content',...

How do I execute QTcpSocket in a different thread?

How do I execute QTcpSocket functions in a different thread? ...