What are background, foreground & main threads ?
Hi folks, what's the difference between background, foreground & main threads? What are the diff types of threads in .NET? TIA ...
Hi folks, what's the difference between background, foreground & main threads? What are the diff types of threads in .NET? TIA ...
Hello, I have a cmd command that needs to be executed, when the command starts it starts to fill a progressbar. When the cmd command is done the progressbar needs to fill up to 100. This is the code i use, but it gives me an error when the progressbar.Value = 100 comes up. Public Class Form1 Dim teller As Integer Private Sub ...
Hello everyone... I am using vb.net, and in my program I get this 'crossthread operation not valid' error when I run my backgroundworker that will make this textbox enabled true. My main sub will first turn the enabled to false, and when the backgroundworker runs it will turn it back true then exit. Why does it give me an error? FYI: Th...
While my .Net 3.5 app was running, the Windows Task Manager shown that my app had 16 threads. I collected a memory dump for the process and opened it using WinDbg/SOS. Running the !threads command reveals that I have : ThreadCount: 456 UnstartedThread: 0 BackgroundThread: 6 PendingThread: 0 DeadThread: 449 Hosted Runtime: no Here are...
Ok this may be really simple but everything I try just seems to hit a brick wall. I have a view model with two properties, which are bound to my WPF form: bool IsWorking {get;set;} ObservableCollection<OtherViewModel> PendingItems {get;set;} I have a method that I call to fetch some new pending items from outlook, however I also wh...
Disclaimer: My posts are apparently always verbose. If you happen to know the answer to the title question, feel free to just answer it without reading my extended discussion below. The System.Threading.Interlocked class provides some very useful methods to assist in writing thread-safe code. One of the more complex methods is Compare...
I have an app (using retain/release, not GC) that maintains an NSArray instance variable, which is exposed as a property like so: @interface MyObject : NSObject { NSArray* myArray; } @property (copy) NSArray* myArray; @end I want to access the contents of this array from a secondary thread, which is detached using -performSelector...
Possible Duplicates: Sleep in Javascript Is there some way to introduce a delay in javascript? how to make a sleep in javascript? It seems no sleep() function provided, can we make one? ...
Me and a friend were debating whether the number of threads in a threadpool should be process count + 1 or just process count. I chose just processor count because there is a even number of threads that can be distributed to each processor, and he chose processor count + 1 because he thinks it'll help him optimize performance So my que...
I understand threads in theory, but I have no idea how to implement them in Java. The circles are supposed to be threads and the rectangles are supposed to be buffers. I have this all coded but it doesn't work, so I am starting new. My source of confusion comes from the fact that I need this cycle to repeat many times and in this or...
I'm trying to write a WPF application that will update a set of text boxes and labels at run time using threads but the problem is that when ever a thread tries to update the text boxes and labels I get the following error: "The calling thread cannot access this object because a different thread owns it." Is it possible to update the co...
I need to write a simple app that runs two threads: - thread 1: runs at timed periods, let's say every 1 minute - thread 2: just a 'normal' while True loop that does 'stuff' if not the requirement to run at timed interval I would have not looked at twisted at all, but simple sleep(60) is not good enough and construction like: l = task....
Hi, I was going through some code snippets looking at the synchronization aspect. I believe locking happens on objects. In the case of java we only have references to objects. Java should use the reference to procure the object and lock it. What happens if the reference happens to be null? I feel this would break. If this were to work t...
Hi everyone. Could anyone help to explain how can I interact with message loop in WPF? I know how to start it using System.Windows.Threading.Dispatcher.Run() Now, I just need a way to call it. I have a while-loop and I whant to process messages in a message loop from it. while (state == DebuggerStaus.Waiting) { ...
Hello there, i am facing a problem in windows mobile 6. i have developed an app and i have used Timer class that is present in System.Threading namespace present in mscorlib.dll assembly. the problem is that when i debug it or when i deploy it by creating proper cab file from visual studio 2008 on my device (HTC ELF0300) it runs fine bu...
Hi, I've created an abstract class which implements a method that runs another abstract method on a seperate thread, like this: public abstract class ATest { Thread t; protected String status; public void Start() { ThreadStart ts = new ThreadStart(PerformTest); t = new Thread...
I would like to map a thread_id. This in C/CUDA but it is more an algebraic problem that I am trying to solve. So the mapping I am trying to achieve is along the lines: Threads 0-15: read value array[0] Threads 16-31: read value [3] Threads 32-47: read value [0] Threads 48-63: read value [3] Threads 64-79: read value array[6] Thread...
We have a spring application (single-threaded by design). We want to adapt it to be multi-threaded. One Idea was to create a parent thread and spawn different threads which would instantiate their own app context and run in parallel. (Memory and cpu are not a concern as of now). I am not sure how singletons are realized in spring. Does s...
Is the following inefficient? I want to allocate nearly all resources to threads but I'm wondering if in this case this loop will consume a lot of CPU time. Thanks! threads = create_threads #method that returns an Array of Threads loop do alive = false threads.each do |thread| if thread.alive? alive = true end end ...
Hi guys, I'm developing a small app, which would have Swing GUI. App is doing IO task in another thread, when that thread finishes GUI should be updated acordingly to reflect thread's operation result. Class running in a (worker, non-GUI) has object passed to it in contructor which would be used for updating GUI, so I don't need to put ...