multithreading

How do i know if a thread is suspended under Windows CE

Can I get a threads suspend count under Windows CE, using C or Visual C++, without calling resume or suspend functions? The only way I can see of doing it is something like int Count = SuspendThread(ThreadHandle); ResumeThread(ThreadHandle); This has a couple of problems, firstly, I'd rather not suspend the thread, and secondly the...

C++ - threads and multiple queues

I need to build a system of workers (represented as threads) and (multiple) queues. Individual jobs are waiting in one of the queues and waits for a worker thread to process them. Each worker can process jobs only from some of the queues. No spin-waiting. C/C++, pthreads, standard POSIX. The problem for me is the "multiple queues" thing...

Using OpenNETCF.Net.Ftp inside a custom class instead of inside a Windows Form

Exact duplicate of Using OpenNETCF.Net.Ftp inside a class instead of inside a Windows Form So far I am using an FTP object inside a Windows form. FTP object runs in a separate thread, so to ensure that my app doesn't freeze up, I use the following piece of code: private void OnResponse(string response) { if (this.InvokeRe...

WPF: How to handle long running "thread"

good evening! currently i'm developing a wpf-client for some rest-service. the communcation with the rest-service is no problem and is done in an extra assembly (communcation-interface). basically: i have a somehow "search"-button which executes a method. this method communicates with the service, updates some textboxes and a progress-...

How to restrict a method to a particular thread?

I have a method that for thread-safety reasons should only ever be used by a particular thread. If another thread tries to use it, I would like an exception to be thrown. public void UnsafeMethod() { if (CurrentThreadId != this.initialThreadId) throw new SomeException("Can only be run on the special thread."); // continu...

help needed in threading implementation in NIO

I want to have create NIOServer which reads data from client using 1 thread and writes data to the client using another thread. also accepting client connection will be in some other thread. Is there any online help Thanks Deepak ...

C# Console: Write while reading and retain structure.

I am writing a C# console application that connects to a server trough TCP, it uses a separate thread to listen for incoming messages from the server and I want it to write them to the console while at the same time reading a message from the console. I was able to do that, but I have a problem. The console displays this while I type an...

How to keep a process running on a remote windows server

I need to implement a background process that runs on a remote windows server 24/7. My development environment is C#/ASP.NET 3.5. The purpose of the process is to: Send reminder e-mails to employees and customers at appropriate times (say 5:00PM on the day before a job is scheduled) Query and save GPS coordinates of employees w...

Does multithreading make sense for IO-bound operations?

When performing many disk operations, does multithreading help, hinder, or make no difference? For example, when copying many files from one folder to another. Clarification: I understand that when other operations are performed, concurrency will obviously make a difference. If the task was to open an image file, convert to another for...

is using threads and ruby mechanize safe ?

Does anyone ever see alot of errors like this: Exception `Net::HTTPBadResponse' at /usr/lib/ruby/1.8/net/http.rb:2022 - wrong status line: SOME HTML CODE HERE When using threads and mechanize? I'm relatively certain that this is some bad behavior between threads and the net/http library, but does anyone have any advice as far as the upp...

.NET Framework thread "ancestry"

I am looking for a way to determine for a thread on which other thread it was originally spawned. I do not know whether a mechanism exists to do this, similar to the "Parent" property on Tasks in the new Task Parallel Library for .NET 4 Edit: Further investigation actually seems to indicate that there is no location to store this inform...

How to get a thread to continue after write() has written less bytes than requested?

I'm using the following code to write data through a named pipe from one application to another. The thread where the writing is taken place should never be exited. But if r_write() returns less than it should, the thread/program stops for some reason. How can I make the thread continue once write has returned less than it should? ssize...

Adding stackless threading to BSD Kernel?

IronPort developed a stackless threading model that allows the IronPort appliance to support more than 10,000 simultaneous connections in contrast to the 100 connections supported on a traditional OS. If one wanted to do the same but to make it open source, where should they start? ...

How to set name to a Win32 Thread?

How do I set a name to a Win32 thread. I did'nt find any Win32 API to achieve the same. Basically I want to add the Thread Name in the Log file. Is TLS (Thread Local Storage) the only way to do it? ...

Problem with delegate Syntax in C#

I built a Testbox to learn something about threading in windows form applications. Silverlight and Java are providing the Dispatcher, which really helps when updating GUI Elements. Code Samples: Declaration Class Delegate public delegate void d_SingleString(string newText); Create Thread _thread_active = true; Thread...

WPF: finding the location of an element

Before answering, it is not as easy question as you might have thought about when you read the title. I have an ItemsControl which is binded to an ObservableCollection of T and data being described as a DataTemplate. So far it is a classic case. When I add a new element I need to know the exact coordinate and positions inside the windo...

Windows Listener Service

How do I write a windows service in c# that listens for tcp connections and processes these connections? The problem is that I want a better method than to "block" in the main thread e.g. while(true) ; I can start the listener on another thread but the main thread needs to block to prevent the application from exiting (and the ser...

How can I use threads in C# to load several images from the web at once?

Hi all, I have a windows forms application in .NET 3.5. There's one form with 20 picture boxes. There's also an array with 20 image URL's. The goal is to loop through the array of URL's and load the images from the web into the picture boxes. I tried having a standard foreach loop and use the picture box LoadAsync() method, but it does...

OpenNetCF FTP class multithreading question

Currently, I have something like: public partial class Form1 : Form { delegate void StringDelegate(string value); private FTP m_ftp; public Form1() { InitializeComponent(); } private void connect_Click(object sender, EventArgs e) { OnResponse("Connecting"); m_ftp = new FTP(server.Text); m_ftp.ResponseReceived += new FTPResponseHandle...

c++ implementing cancel across thread pools

I have several thread pools and I want my application to handle a cancel operation. To do this I implemented a shared operation controller object which I poll at various spots in each thread pool worker function that is called. Is this a good model, or is there a better way to do it? I just worry about having all of these operationC...