multithreading

How to deal with java threads.

I have a class called communicator. This class is a listener of a thread receiving events from another program. Also this class has a method call refresh that sends and action to the program a waits for the response that comes through the listener. Both methods are in the same class but called by diferent threads. public void processRe...

C multi-threading origin

In my copy of C Programming Language (aka: K&R), there seems no mention of multithreading. Is the book less complete than I imagined? Did multithreading emerge after it was written? Am I thinking about this the wrong way? Where does the concept of multithreading fit into the C world? Edit: I think my original question have been: yo...

What are threads?

What are threads? Why do you think I should care about them? Where would you suggest I go to learn more (I'm working in Delphi, if that matters). Thanks! -- Al C. ...

Threading/Synchronization

What is the real difference Conceptually and Implementation point of view between Semophore, Mutex, Monitor? We say Semophores are resource allocation counter... OK I understand this.. For Mutex we say mutex are Binary Semophore... Gosh what's that??? Monitor guards the entry point for an objects... i.e. only one thread can acquire i...

C++ Letting a boost thread wait for 1 second

I have created a boost thread using: boost::thread thrd(&connectionThread); where connectionThread is a simple void function. This works fine, however, when I try to make it wait for some seconds, for example using: boost::xtime xt; boost::xtime_get(&xt, boost::TIME_UTC); xt.sec += 1; boost::thread::sleep(xt); // Sleep for 1 second ...

proper usage of synchronized singleton?

So I am thinking about building a hobby project, one off kind of thing, just to brush up on my programming/design. It's basically a multi threaded web spider, updating the same data structure object->int. So it is definitely overkill to use a database for this, and the only thing I could think of is a thread-safe singleton used to con...

How to name a thread in Linux?

I have a multithreaded Linux application written in C/C++. I have chosen names for my threads. To aid debugging, I would like these names to be visible in GDB, "top", etc. Is this possible, and if so how? (There are plenty of reasons to know the thread name. Right now I want to know which thread is taking up 50% CPU (as reported by ...

Try/Catch and threading

I have an idea why but I'd like to ask if someone has a good grasp on why the exception raised inside a thread is never caught by the code that started it. Here's some very simple code to demonstrate what I mean: using System; using System.Collections.Generic; using System.Threading; namespace TestCrash { class Program { ...

Thread permissions in ASP.NET

I'm launching a lengthy import on a new thread in an ASP.NET page. Everything is working fine except that I get a failed IO permission when I try to write to my log file from the worker thread, which is not a problem in the primary thread. I am using IIS7 integrated mode without impersonation, although I got the same results with imper...

Simplest way to stop all java threads from disappearing into IO ?

I have a web-application that only requires the servlet-container to run. My login page and front page do not have any backend transactions, but all others do. What'd be the simplest way to guarantee that I don't send all my threads into some socket wait for a backend system (CXF-webservices) ? This is weblogic 10.3 but I'm really not th...

Thread safety object - Static or not? (.NET)

I was recently in an Interview and the tech guy asked me about how to make teh app thread safe. Well, after explaining the lock() correctly, he said it is not a good idea to have the object as static. private static readonly object _syncLock = new object(); He claimed the reason is that static makes that object slower for threads to ...

C# IE BHO: Do work asynchroniously while keeping to the same thread?

I have an IE BHO that's in development in C#. It is supposed to wait for the user to do some stuff, contact our server and download some data, and then alter the DOM of the currently loaded web page with the results. I am running into some seemingly insurmountable issues relating to the rules of COM compartmentalization and threading --...

Reading interlocked variables

Assume: A. C++ under WIN32. B. A properly aligned volatile integer incremented and decremented using InterlockedIncrement() and InterlockedDecrement(). __declspec (align(8)) volatile LONG _ServerState = 0; If I want to simply read _ServerState, do I need to read the variable via an InterlockedXXX function? For instance, I have seen...

Interpreting BEA weblogic thread dumps - helpful documents and/or tools?

I am a neophyte at Weblogic troubleshooting. We have an issue on our production environment. I cannot access the ennvironment directly (our hosting people will do that, but it's some hours until I can ask them things). I have a thread dump from the time the issue was evident on production. I can look through the dump and deduce some th...

Any way to change linking to avoid the LD_PRELOAD on HPUX?

I think I understand why I need LD_PRELOAD set when loading a multithreaded applicatoin that loads a single threaded library that loads libcl.2 but I was wondering if I could use some linker setting to avoid this. Any help appreciated. Update: Perl loads dynamic /usr/lib/libc.2 Perl loads DB2.sl DB2 Attempts to loa...

Using C# MethodInvoker.Invoke() for a GUI app... is this good?

Hi, Using C# 2.0 and the MethodInvoker delegate, I have a GUI application receiving some event from either the GUI thread or from a worker thread. I use the following pattern for handling the event in the form: private void SomeEventHandler(object sender, EventArgs e) { MethodInvoker method = delegate { uiSomeT...

Can I update WPF StatusBar text before making the user wait?

I've got a WPF application with a status bar. <StatusBar Grid.Row="1" Height="23" Name="StatusBar1" VerticalAlignment="Bottom"> <TextBlock Name="TextBlockStatus" /> </StatusBar> I'd like to display text there and switch to the hourglass Wait cursor when I do a small amount of work. This code will ...

Threads in Spring

I have a Web application using spring and hibernate and struts (it runs on Tomcat) The call sequence is something like this... Struts action calls spring service bean which in turn calls Spring DAO bean. The DAO implementation is a Hibernate implementation. The question is Would all my spring beans be running in the same thread ? Can ...

Sharing message queues among threads (in Windows)

Is there any way to share a message queue among several threads, or otherwise to read a message queue of a different thread, without using hooks? ...

Thread Modelling

In my university days I came across a Java app in one of my courses. You basically modeled your threads (any actions they perform etc.) in a simple language. It would draw a diagram and identify and issues with your threading. Does anyone know what this app is called? I have tried for the last 30 mins on Google but can't find anything. ...