multithreading

Thread sleep in a for loop

I need your help for using this method: for (int i =0; i<dt.count; i++) { process... sleep(3000); } int sleeptime=0; private void timer2_Tick(object sender, EventArgs e) { for (int i = 0; i &#60; mylist.Items.Count;) { listBox1.Items.Add(mylist.Items[i].Name.ToString() + "starting..."); sleeptime = int.P...

Threading DbExpress queries

I have only done "GUI" database access in Delphi with DbExpress components, but now I'd like to execute one query on background. I read some where that TSQLConnection is not thread safe and I have to create new connection for each thread. I see that there's CloneConnection in TSQLConnection, but help claims that new connections are owned...

multithread performance problem for web service call

Hello everyone, Here is my sample program for web service server side and client side. I met with a strnage performance problem, which is, even if I increase the number of threads to call web services, the performance is not improved. At the same time, the CPU/memory/network consumption from performance panel of task manager is low. I a...

NSThread crashes on second call (iPhone)

i got an object and in that object i start my thread (for loading doing some url loading) when i have a return of my data i call a selector to perform on the main thread. works fine if i call it the first time , second time it crashes ( no specific error) [NSThread detachNewThreadSelector:@selector(doThread:) toTarget:self ...

Delphi form creation without freezing main thread

Hello everyone. I am having trouble with something i wanna do. I have some big forms which take some time to create. To make the app load faster i thought of letting the forms be created in a thread which is created at main form's OnCreate event. The thread has a FApplication field of type TApplication which obviously is the Application...

What is the impact of Thread.Sleep(1) in C#?

In a windows form application what is the impact of calling Thread.Sleep(1) as illustrated in the following code: public Constructor() { Thread thread = new Thread(Task); thread.IsBackground = true; thread.Start(); } private void Task() { while (true) { // do something Thread.Sleep(1); } } Will...

On which operationg system is threaded programming sufficient to utilize multiple cores?

I would like to use my multi-threading programming skills (I got skills), but I realize that that is not enough. My threads may still compete for the same core if the operating system is not aware of the potential. What OS/compiler/library combination can I use on Intel Xeon architecture to thread to the cores? ...

Detecting deadlocks in a C# application

I am debugging an application that I suspect is getting deadlocked and hanging. However, this only occurs every few days, and it never happens on my computer so I can't hook a debugger up to it. Are there any utilities or methods I can use to query the running application and find out what methods/locks/whatever it is deadlocked on? Upd...

Turn off multithreading or limit core usage in F#?

Is there a way to turn off multithreading or limit the number of cores used by an F# app? I'm aware this wouldn't be done in a production environment but I'm curious if I have to actually install the application on a single cored system in order to see how it would perform. ...

In Delphi, is outputdebugstring thread safe?

Simple question i belive, is outputdebugstring(pansichar('')); Thread safe? I/We have been using it in threads for debugging, and i never occurred to me if i should be doing it a different way. (delphi7) ...

Unmanaged thread running Managed Code

I made a software that loads external module made by clients. This software is supposed to be HA (High availability) meaning it CAN'T be allowed to crash. For that purpose, I created a class which creates a thread, run the client module function in it, and returns. The class allows a certain time to execute the function, and if it take...

How to call a python function from a foreign language thread (C++)

Hi, I am developing a program that use DirectShow to grab audio data from media files. DirectShow use thread to pass audio data to the callback function in my program, and I let that callback function call another function in Python. I use Boost.Python to wrapper my library, the callback function : class PythonCallback { private: ...

How many threads to create and when?

I have a networking Linux application which receives RTP streams from multiple destinations, does very simple packet modification and then forwards the streams to the final destination. How do I decide how many threads I should have to process the data? I suppose, I cannot open a thread for each RTP stream as there could be thousands. S...

100% CPU usage in Delphi

I use Indy 9 with Delphi 5. In my application I want to communicate with a network device via UDP. So I use UDPServer comp. in a class which is derived from TThread. When I write similar to the following code then CPU usage is 100%. in the thread : while not terminated do begin if GetMessage(Msg, 0, 0, 0) then begin if Msg.messag...

How to pass an interface pointer to a thread?

Note: Using raw Win32 CreateTheard() API No MFC An interface is simply a pointer to a vtable Question: How to pass an interface pointer to a thread? Illustration: IS8Simulation *pis8 = NULL; ... CoCreateInstance( clsid, NULL, CLSCTX_LOCAL_SERVER, __uuidof(IS8S...

.NET Dictionary: is only enumerating thread safe?

Is simply enumerating a .NET Dictionary from multiple threads safe? No modification of the Dictionary takes place at all. ...

Progress Dialog in Swing

How can I make a modal JDialog without buttons appear for the duration it takes a Runnable instance to complete and have that instance update a progress bar/message on that Dialog. Clearly spaghetti code might be this working, but I'm looking for a clean design if one exists. Thanks. ...

Why won't my textbox update when I am doing the exact same thing just with a different function?

My TextBox won't update! I am using it as a Log to update what other things are doing... Form 1 code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using System.Data.OleDb; using System.Collections.Specialized; using System.Tex...

Declarative thread safety in .NET

Hi, I need to make an existing app thread safe. Due circumstances (see below), I decided to use one single ReaderWriterLock for the entire graph of business objects. All methods/properties must look like these: public int MyReadOperation(string inputParam) { rwLock.AcquireReaderLock(10000); try { // do all read operation...

Best performing way to guarantee data consistency between concurrent web service calls?

Multiple clients are concurrently accessing a JAX-JWS webservice running on Glassfish or some other application server. Persistence is provided by something like Hibernate or OpenJPA. Database is Microsoft SQL Server 2005. The service takes a few input parameters, some "magic" occurs, and then returns what is basically a transformed ver...