multithreading

How to run a thread inside a webservice

Could someone help me on this, I have created simple web services using axis2 , apache and tomcat. This web service has a queue that keeps xml files sent from a client, so whenever a client calls a method on the webservice, the webservice loads this xml to its queue. Now I want to have a thread running in the webservice which monitors t...

In what situation do you use a semaphore over a mutex in C++?

Throughout the resources I've read about multithreading, mutex is more often used and discussed compared to a semaphore. My question is when do you use a semaphore over a mutex? I don't see semaphores in Boost thread. Does that mean semaphores no longer used much these days? As far as I've understand, semaphores allow a resource to be s...

Problem with waiting for condition in Java

Hello. I want to make one thread that puts values to a queue when it gets empty and wait for this condition while it is not. Here's the code I've tried to use, but it prints Adding new Taking Value 1 Taking Value 2 Taking Value 3 Taking Value 4 So it is working only one time. What is the problem? import java.util.concurrent.BlockingQ...

Ruby thread newbie,something went very wrong.Can you help me spot what it is?

In a thread, I'm doing the following: builder_thread = Thread.new do FileUtils.cp_r(folder,dest) io_object = IO.popen(command) Thread.current["output"] = "" Thread.current["pid"] = io_object.pid Thread.current["basedir"] = dest io_object.each { |out| Thread.current["output"] += out } end and this works ok, when...

Calling javascript on webpage from static method in BHO

Im writing a BHO for internet explorer where i need to call javascript methods on all open browser instances from a 'static' (or a 'global') callback method. I'm running into issues that i'm sure are related to multi-threading in COM. I had few general questions regarding this (i am new to windows programming!). Every browser would hav...

Detect when threads are running in a python application?

How can we detect when threads are running in a python application? Motivation: We were recently debugging a large Python application that had several customer supplied modules that were supplied without source code. Unbeknowst to us (and our customer!), one of these modules would launch threads under very specific (and undocumented) co...

Are python functions threadsafe? (Particularly this one?)

Before answering, please understand I do NOT want you to do the work for me. I would rather appreciate a worded answer as to why my (possibly theoretical) problem exists, and an explanation of the process to go about fixing it. I find it harder to learn properly when someone just does the work for me. Thank you in advance. I have thi...

Multi-threading calls in Windows Forms application?

I'm trying to make my C# application multi threaded because sometimes, I get an exception that says I have made a call to a thread in an unsafe manner. I've never done any multi-threading before in a program, so bear with me if I sound kinda ignorant on the issue. The overview of my program is that I want to make a performance monitori...

Am I using Java PooledConnections correctly?

Hello, I want to use pooled connections with Java (because it is costly to create one connection per thread) so I'm using the MysqlConnectionPoolDataSource() object. I'm persisting my data source across threads. So, I'm only using one datasource throughout the application like this: startRegistry(); // creates an RMI registry for...

If the call stack gets corrupted, would that crash only the current thread, or my entire application?

I'm a noob when it comes to threading in C#, and I'm not sure if each thread is supposed to have its own call stack? Basically, if I get a "Run-Time Check Failure #0 - The value of ESP was not properly " , would that crash only the thread in which it occured, or the entire program? ...

J2ME/Java: Referencing StringBuffer through Threads

This question might be long, but I want to provide much information. Overview: I'm creating a Stock Quotes Ticker app for Blackberry. But I'm having problems with my StringBuffer that contains an individual Stock information. Process: My app connects to our server via SocketConnection. The server sends out a formatted set of strings th...

Cannot obtain shared variable value in separate threads

My program has a server thread and separate client threads that are individual connections to other servers. So how my program works is the client threads make individual requests, and when each of them so, I increment the shared variable iTimeStamp. However, I need to access this shared variable value through my Server thread, but when...

Put a GUI control on a different thread?

I'm assuming it's possibly to do so as programs like google chrome have gone one better and put each tab on a separate process. So how can i put a GUI control such as a datagridview on a separate thread? ...

Why can't java use thread context classloader when a method is literally called?

I've written a custom classloader 'JarClassLoader', which itself works ok, since the following test case is green: public void testJarClassLoader() throws Exception { JarClassLoader cl = new JarClassLoader(); cl.addURLsByClassPath("lib/a-lot-of-jars.jar|lib/more-jars.jar", "\\|"); Class c = cl.loadClass("com.packagepath.cla...

C socket API is thread safe?

I'm using both Linux and Win32 socket APIs. In my program, multiple threads share a socket handle. In particular, multiple threads call send with the shared socket handle (i.e., the same port). In this case, do I have to put a lock for thread safety? I was unable to find the answer. I may do a test, but want to hear your experiences. ED...

Is there a way to check what's running in the .NET Thread Pool?

Normally i was creating each thread per action i wanted to do multithreaded. I was doing it like that: private Thread threadForWycena; private void someMethod() { threadForWycena = new Thread(globalnaWycena); threadForWycena.Start(); } Then when user wanted to close one of the gui's i was checking for this thread and if...

Are WCF request handling Thread Agile?

I have seen lots of documentation on how Agile Asp.Net Request handling is? I want to know is the case same with WCF Request handling. Can we rely on the fact that the Thread that starts Wcf request handling will finish it? I am maintaining a Wcf Application where at lots of places ThreadStatic variables are used. Although the code is w...

Starting multiple threads and keeping track of them from my .NET application

I would like to start x number of threads from my .NET application, and I would like to keep track of them as I will need to terminate them manually or when my application closes my application later on. Example ==> Start Thread Alpha, Start Thread Beta .. then at any point in my application I should be able to say Terminate Thread Beta...

Call a TDataModule method in TThread.Execute

Hello people, In general, is it possible in a TThread.Execute procedure to call a TDataModule method, in which there is no visual activity involved? Thanks to all, Massimo. ...

C# Appropriate Multi-Threading Option

Scenario I have a very heavy number crunching process that pools large datasets from 3 different databases and then does a bit of processing on each to eventually produce a result. This process is fine if it is only used by a single asset. However I now have 3500 assets that I need to process, which takes about 1hr30mins in the state of...