multithreading

Is it safe to use java.util.Timer inside servlet ?

Hi all, for many reasons, it is not good practice to use threads inside servlet. java.util.Timer seems like wrapper to threads. so also it is not safe to use it ? if yes, what is the safest way to schedule task in servlet ? thanks,,, ...

multithreading in adobe flex

i want to know if i can use threading model like posix or any else in flex, i am a beginer of flex and i want to know if i can use threads in it for multitasking, tahnks ...

Is C++ static member variable initialization thread-safe?

Hi! According to following resources, in C++(Specially Visual C++) scoped static variable initialization isn't thread safe. But, global static variables are safe. http://stackoverflow.com/questions/1052168/thread-safe-static-variables-without-mutexing http://blogs.msdn.com/oldnewthing/archive/2004/03/08/85901.aspx So, is following co...

When Asp.net terminates background threads ?

Hi Everyone, I was working on a project and there is bulk e-mail sending part of it and when user clicks on the button, he/she gets the "Thanks the e-mails have been sent" immediately as a Response and the same method is firing an async thread as well. ThreadPool.QueueUserWorkItem(SendEMail, _message); This thread is queued when user...

What's the meaning of printing a thread instance in Java?

For example, System.out.println( Thread.currentThread() ); gives Thread[main,5,main] What does [main,5,main] refer to? I am guessing perhaps one of them is the name, but I want to know what it all means precisely. ...

CPU Registers and Cache Coherence

What's the relation between CPU registers and CPU cache when it comes to cache coherence protocols such as MESI? If a certain value is stored in the CPU's cache, and is also stored in a register, then what will happen if the cache line will be marked as "dirty"? to my understanding there is no gurentee that the register will update it's ...

How can I handle window messages from a separate thread?

I wish to launch a separate thread for handling window messages (via a blocking GetMessage loop), but still create the windows in the initial thread, afterward. Within the separate thread, as soon as it launches, I am calling PeekMessage with PM_NOREMOVE to ensure a message queue exists (is this necessary?), followed by.. AttachThreadI...

Deadlock, some questions...

After some phase of testing of my task scheduler I encountered a deadlock pretty much random. I want to ask some help, especially I want to know if my approach can take to a deadlock or if the problem is elsewhere. Before starting i'll say that the application is a fullscreen game. (in case it may influence anything) I'll explain in wor...

Python epoll.register threadsafe?

Does anyone know if I can call epoll.register from another thread safely? Here is what I am imagining: Thread 1: epoll.poll() Thread 2: adding some fd to the same epoll object with epoll.register http://docs.python.org/library/select.html ...

Any decent scheme implementation that has *no* threading libs?

Hi, I am considering which scheme to use. I would like to use a scheme that has or can be compiled to have no threading support. I have to avoid the layers that threading libs provide. I want an implementation that has no code for interpreter locks, etc. Something that can compile to C is ideal. This will be Unix only. Chicken and Gambi...

File downloading using python with threads

I'm creating a python script which accepts a path to a remote file and an n number of threads. The file's size will be divided by the number of threads, when each thread completes I want them to append the fetch data to a local file. How do I manage it so that the order in which the threads where generated will append to the local file ...

.NET Reverse Semaphore?

Perhaps it's too late at night, but I can't think of a nice way to do this. I've started a bunch of asynchronous downloads, and I want to wait until they all complete before the program terminates. This leads me to believe I should increment something when a download starts, at decrement it when it finishes. But then how do I wait until...

Using performSelectorInBackground to run loading indicator

I have such a code: [self performSelectorInBackground:@selector(indicator) withObject:nil]; [self mail]; //opening my controller of e-mail sending - (void)indicator { [actView startAnimating]; } This works fine, but i'm afraid of thread safety. I'm not allocating memory in a second thread, but smth tell's me that's too simple:) ...

Threads permission

Server creates new thread in a threadpool. This thread reads some stuff into buffer and so on and after that, some code executes. I'd want to secure myself by changing permission of thread to lower, before this code which could be unsafe (or it's behavior could be changed ... by hacking and so on...) I am going (ha... but have nearly no...

Is IronRuby ScriptSource.Execute thread safe?

We are implemented expression evaluator via hosting IronRuby engine. Simplified version of evaluator you can see here. Now we are trying to get more performance from IronRuby via executing expressions in many threads (and we got it). One question bothers us - is Execute method thread safe? ...

Does WaitForSingleObject Serve as a Memory Barrier?

A question yesterday about doubled-checked locking started a chain of thoughts that left me unsure about a simple situation. In the following code, is it possible to hit the printf of “No longer in sync”? In this simple example, the values would likely be on the same cache line, so I think it would be less likely (assuming the possibili...

QMetaObject::invokeMethod returns true, but method is never called

hello. I'm trying to run a method on the GUI thread using QMetaObject::invokeMethod, which returns true. But, if I use Qt::QueuedConnection my method never gets called (even if invokeMethod returns true). This is what I'm using: QMetaObject::invokeMethod(this, "draw_widgets", Qt::QueuedConnection) I don't get any error messages or an...

File transfer in FTP

I want to transfer files using ftp in a simple and effective manner. For example, if we want to send a file means we just put the entire file with commands, but if it is a huge file and the network strength is low means automatically the transferspeed will be reduced. What will be the effective method to transfer a huge file even the net...

Getting a handle to the processes main thread

I have created an additional thread in some small testing app and want to suspend the main thread from this additional thread. The additional thread is created via CreateRemoteThread from an external process. Since SuspendThread needs a HANDLE to the thread which should be suspended, I want to know how to get this HANDLE from code runni...

What is thread contention?

Can someone please explain simply what thread contention is? I have googled it, but cannot seem to find a simple explanation. Thanks ...