multithreading

using ScheduledExecutorService to start and stop timer

From my readings, it seems that ScheduledExecutorService is the right way to start and stop timers in Java. I need to port some code that starts and stops a timer. This is not a periodic timer. This code, stops the timer before starting it. So, effectively every start is really a restart(). I am looking for the right way to do this usin...

Does Javafx support starting your own thread?

I've wrote a simple Javafx application which starts a new thread and it works OK from Netbeans. But I'm getting following warning during compilation: explicit use of threads is not supported Does it mean that it might now work in all possible devices like mobile phones or browser? ...

Synchronized makes object lock

I have a confusion about object lock. The below class having 4 methods, the method addB() is synchronized. In my scienario, there are 4 threads. When a thread-2 access the addB() method (it creates a lock on Test object), will there any other thread access addC() or addD() same time? Does the Object lock allows only one thread at a ti...

Popping a MessageBox for the main app with Backgroundworker in WPF

Hi there, In a WPF app, I am using a BackgroundWorker to periodically check for a condition on the server. While that works fine, I want to pop a MessageBox notifing the users if something fails during the check. Here's what I have: public static void StartWorker() { worker = new BackgroundWorker(); worker.DoWork += DoSomeWor...

C# IE BHO: How do I marshal DOM objects to a worker thread?

I am trying to write a Browser Helper Object (BHO) in C# that manipulates the DOM on a separate thread. I've seen several other questions related to this, and the answer seems to be "you need to marshal the DOM objects from the thread they were created on to your worker thread." Good advice, and it makes perfect sense, but I can find no ...

Single Task processed by multiple backgroundworkers?

I have an array that is a list of files in a folder, I'm processing the files and renaming them. It takes about 15 minutes to rename them all, this is done daily. I currently have 1 Backgroundworker to handle this and update the UI. My question is, this: How can I use more than 1 Backgroundworker to use more than 25% of the CPU to do t...

DispatcherTimer and high CPU load

Hey, I have an WPF application and using DispatcherTimer to fire an event every minute. I run my app and the cpu load jumps to 100%. I tried to compile an app without using a timer and cpu load was very low as I it expected to be. Sample code: DispatcherTimer MainTimer = new DispatcherTimer(); MainTimer.Tick += new EventHandler(Core.Ti...

Why would a control be on a different thread from the one I'm working in?

I'm not (intentionally) using threads in my C# app. In fact my main method has a [STAThread], which I thought meant I'd only be using one thread. Why then, would I be getting this error message? Cross-thread operation not valid: Control 'messageLog' accessed from a thread other than the thread it was created on. ...

Active object pattern instead of background worker class

The active object pattern was mentioned on Stack Overflow here. I have used the background worker class in C# in the past. The active object pattern looks interesting but more complicated. When should the active object pattern be used instead of the background worker class? ...

There is a type named thread in lua. Does anyone know something of this?

I was reading the lua manual (looking for something) and I found out that there is a type named thread in lua. Of wath I read it represents independent threads of execution and it is used to implement coroutines. Here is the link to the place I read it. http://www.lua.org/manual/5.1/manual.html#2.2 How do I use these threads? Are there...

Insert Concurrency Issue - Multithreaded Environment

I have an issue that the same stored procedure is being invoked at exactly the same time with exactly the same paramenters. The purpose of the stored procedure is to fetch a record if it exists or to create and fetch the record if it does not exist. The problem is that both threads are checking the existence of the record and reporting...

No package Thread, but tcl_platform(threaded) is true

I've got Tcl8.5 installed (debian package). I need the Thread library. When I do a package require Thread, it fails to find the package. However, tcl_platform(threaded) is set to true. Why is this the case? Do I need to grab another package? I have tcllib. ...

Is Java MulticastSocket threadsafe?

I have two threads. First one sends datagrams with a MulticastSocket in loop; the second thread receives datagrams using the same instance of MulticastSocket in loop. It seems to be working properly, but I'm still in doubts. Can these two threads use the same instance of MulticastSocket? Is MulticastSocket threadsafe in respect send/re...

java.sql.Connection not visible from within a thread.

I created one thread with java.sql.Connection and String parameters. But from within the thread, I observed that String value was available but Connection object was not. Any clues? (Editing details into question): Well, it seems the connection object is available, but closed inside the thread. Here's the code: package com.catgen.hel...

Logging in multi-threaded application in java

What's the best way and best tool for logging in multi-threaded environment, so that each thread has it's own logger instance and separate file. is this even possible? ...

Which C# assembly contains Invoke?

Alternate question: Why is VS10 so keen to complain about Invoke? In my continuing quest to make my app work become the worlds best C# programmer, I have decided that threads are a Good Thing™. MSDN has a helpful article on making thread-safe calls to controls, but it (and seemingly every other article on the subject) obliquely referen...

Why is the explicit management of threads a bad thing?

In a previous question, I made a bit of a faux pas. You see, I'd been reading about threads and had got the impression that they were the tastiest things since kiwi jello. Imagine my confusion then, when I read stuff like this: [T]hreads are A Very Bad Thing. Or, at least, explicit management of threads is a bad thing and Upda...

Concurrency visualization and thread monitoring

Do you know any tools for thread monitoring wich are free for non-commercial or academic usage? For Windows Server 2008. ...

Recommendations on multiple types of games server

Hi, I've already developed some online games (like chess, checkers, risk clone) using server side programming (PHP and C++) and Flash (for the GUI). Now, I'd like to develop some kind of game portal (like www.mytopia.com). In order to do so, I must decide what is a good way to structure my server logic. At first I thought in programming...

Thread-safe Controller and Utility Classes?

So I'm using Spring MVC and in my controller I call several Utility classes. Do the Collections I use in those utility classes need to be synchronized? Similarly, are multiple threads spawned for each user when they access my webpage in the controller meaning I need to ensure thread-safety? ...