multithreading

How to show the progressbar using threading functionality in win32?

In my application I have a simple module were I will read files for some process that will take few seconds..so I thought of displaying a progress bar(using worker thread) while the files are in progress.I have created a thread (code shown below) and also I designed a dialog window with progress control.I used the function MyThreadFunct...

Stopping looping thread in Java

I'm using a thread that is continuously reading from a queue. Something like: public void run() { Object obj; while(true) { synchronized(objectsQueue) { if(objectesQueue.isEmpty()) { try { objectesQueue.wait(); } catch (InterruptedException e) { ...

Displaying progressbar using threading in win 32 applicaition!

In my application I have a simple module were I will read files for some process that will take few seconds..so I thought of displaying a progress bar(using worker thread) while the files are in progress.I have created a thread (code shown below) and also I designed a dialog window with progress control.I used the function MyThreadFunct...

How does large text file viewer work? How to build a large text reader

how does large text file viewer work? I'm assuming that: Threading is used to handle the file The TextBox is updated line by line Effective memory handling is used Are these assumptions correct? if someone were to develop their own, what are the mustsand don'ts? I'm looking to implement one using a DataGrid instead of a TextBox I...

aborting timer threads

As we know each timer elapsed method callbacks on a separate thread. Is there a way to abort the timer thread in c#? Suppose a timer thread is blocked in a long running operation. How would a new thread abort the blocked thread? the Thread.CurrentThread points to the calling thread instead of the blocked thread. ...

lock shared data using c#

Hi, I have a program (C#) with a list of tests to do. Also, I have two thread. one to add task into the list, and one to read and remove from it the performed tasks. I'm using the 'lock' function each time one of the threads want to access to the list. Another thing I want to do is, if the list is empty, the thread who need to read from ...

Windows Workflow Foundation equivalent of "lock"

I have a class that inherits from SequentialWorkflowActivity, which can be executed simultaneously in multiple threads, and I need to make sure that part of the activity is never interrupted never executed across multiple threads How can I do this in a WWF custom activity? ...

Problem with a blocking network task

Hello everyone. I'm new in Java so please forgive any obscene errors that I may make :) I'm developing a program in Java that among other things it should also handle clients that will connect to a server. The server has 3 threads running, and I have created them in the following way : DaemonForUI du; DaemonForPort da; DaemonForCheck ...

How to determine Threading Model of given COM library?

I have a COM library I should use in my ASP.NET MVC application. However I am unsure about its thread apartment model. How can I determine it? ...

Synchronization of threads slows down a multithreaded application

Hello, I have a multithreaded application written in c#. What i noticed is that implementing thread synchronization with lock(this) method slows down the application by 20%. Is that an expected behavior or should i look into the implementation closer? ...

Can I get the stack traces of all threads in my c# app?

I'm debugging an apparent concurrency issue in a largish app that I hack on at work. The bug in question only manifests on certain lower-performance machines after running for many (12+) hours, and I have never reproduced it in the debugger. Because of this, my debugging tools are basically limited to analyzing log files. C# makes it ...

Why does every thread in my application use a different hibernate session?

Hi, I have a web-application which uses hibernate and for some reason every thread (httprequest or other threads related to queueing) uses a different session. I've implemented a HibernateSessionFactory class which looks like this: public class HibernateSessionFactory { private static final ThreadLocal<Session> threadLocal = new ThreadL...

Unmanaged Process in Mono

I want to create a Mono application to start and stop several processes. I only need to be able to start and stop the processes from the Mono application, I do not need any advanced features of managed processes. Users will be able to customize the available processes from a "preferences" menu. The problem is, that I also need to be abl...

what is value of x for load and store

This is some challenge On a single processor system, in which load and store are assumed to be atomic, what are all the possible values for x after both threads have completed in the following execution, assuming that x is initialised to O? Hint: you need to consider how this code might be compiled into machine language. for (int i = 0...

BeginInvoke on ObservableCollection not immediate.

In my code I subscribe to an event that happens on a different thread. Every time this event happens, I receive an string that is posted to the observable collection: Dispatcher currentDispatcher = Dispatcher.CurrentDispatcher; var SerialLog = new ObservableCollection<string>(); private void hitStation_RawCommandSent(object...

How to execute a blocking function that returns a value for a maximum amount of time in Java.

How would I go about making a function that would do this in java. String result = null do { SendData() // Run Blocking Function: ReceiveData() Until it returns a result // or t seconds have elapsed // if something returned, result = something // else result = null } while(result == null); ...

Update JProgressBar from new Thread

How can I update the JProgressBar.setValue(int) from another thread? My secondary goal is do it in the least amount of classes possible. Here is the code I have right now: **Part of the main class....** pp.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent event) ...

iPhone: NSOperationQueue running operations serially

I have a singleton NSOperationQueue that handles all of my network requests. I'm noticing, however, that when I have one particularly long operation running (this particular operation takes at least 25 seconds), my other operations don't run until it completes. maxConcurrentOperationCount is set to NSOperationQueueDefaultMaxConcurrentOp...

C#: Thread.CurrentThread.CurrentUICulture not working consistently

I've been working on a pet project on the weekends to learn more about C# and have encountered an odd problem when working with localization. To be more specific, the problem I have is with System.Threading.Thread.CurrentThread.CurrentUICulture. I've set up my app so that the user can quickly change the language of the app by clicking a...

Java - Multithreading

What is the difference between synchronized methods and synchronized statements ? If possible , please use an example to make it more clear. Thanks. ...