multithreading

postthreadmessage and peekmessage problem in delphi 2006

I created a multichilded application. The application windows (W[n]: TMyWindows) are all the same and all have an private object class instance associated with them (E: TMyObject). The child windows generate through this objects some messages. I have created in the main application two threads which process these messages depending on th...

gdb breakpoint on pthread_create

I am trying to set a breakpoint in linux in gdb for a program creating threads. I would like to set a breakpoint on thread creation, but unfortunately pthread_create is a versioned symbol, and I can't get its full name. If I type: catch thread_start I get Catch of thread_start not yet implemented How is the best way to catch thre...

Blackhen Threading Library

I am looking for documentation for the Blackhen threading library and am unable to find any. I have just found one article here. Can someone please point me to some documention for this library? ...

Utilizing Dual/Quad core Technology

Guys, In C#, when I create a new thread and execute a process on that thread, is there a way to assign it to a particular core? Or does the operating system handle all that automatically? I wrote a multi threaded application and I just want to be sure its optimized for dual/quad core functionality. Thanks ...

Communicating between Kernel Threads in Linux

I am porting a app/PCI driver from vxWorks to Linux and I would like to keep the same architecture if possible. The current driver has 2 tasks(threads) that communicate with each other using message queues. Is there a mechanism to communicate between kernel threads? The message queues are being used to pass buffer addresses and size i...

Process M slow calculations on N threads in Java

I need to run N slow calculations (where N is a fairly large number) and would like to do so on M threads since the slow calculations have a good deal of IO wait time. I have put together a small example that works well for the case that all calculations succeed. However, if a calculation fails the desired behavior is to stop processin...

Changing a C# thread's priority at runtime when only the name is known

Hi, I'm using a third party dll that's creating an AboveNormal priority thread and I'm wondering it it's possible to change the thread's priority. The only thing I know about this thread its his name. Process.GetCurrentProcess().Threads give me only the id of the thread, not the thread's name. Thanks ...

Can I invoke XMPPConnection.sendPacket from concurrent threads ?

Motivation I want extra eyes to confirm that I am able to call this method XMPPConnection.sendPacket( Packet ) concurrently. For my current code, I am invoking a List of Callables (max 3) in a serial fashion. Each Callable sends/receives XMPP packets on the one piece of XMPPConnection. I plan to parallelize these Callables by spinning ...

About atomicity guarantee in C

On x86 machines, instructions like inc, addl are not atomic and under SMP environment it is not safe to use them without lock prefix. But under UP environment it is safe since inc, addl and other simple instructions won't be interrupted. My problem is that, given a C-level statement like x = x + 1; Is there any guarantees that C com...

Can threads be safely created during static initialization?

At some point I remember reading that threads can't be safely created until the first line of main(), because compilers insert special code to make threading work that runs during static initialization time. So if you have a global object that creates a thread on construction, your program may crash. But now I can't find the original art...

Can't find the example projects from Stanford cs193p

I am looking for the Flickr multithreaded example application that is used in lecture 10 "Performance and Threading". He does a few things that I would like to look at. The particular files I'm looking for are ImageLoadingOperation.h and MyTableViewController.m? Does anybody know if they exist somewhere out there and I just missed it? If...

Why are two Java threads (in some cases) more than twice as fast as one?

File: Example1.java public class Example1 implements Runnable { public void run() { for(int i = 0; i < 100000000; i++) { int x = 5; x = x * 4; x = x % 3; x = x + 9000; x = x * 923; } } public static void task() { for(int i = 0; i < 100000000; i++) { int x = 5; x = x ...

Maximum thread limit?

Where can I find documentation on the maximum number of threads allowed in an iPhone application, and what are your experiences with thread performance? Thank you! ...

Transactions - How to avoid deadlocks?

I was asked this question in a .net/C# interview: If we have two threads T1 and T2. T1 acquires a lock on obj1 and then does some processing and acquires a lock on obj2. T2 acquires a lock on obj2 and then does some processing and acquires a lock on obj1. So, we can have a deadlock. What is common technique that we use ...

default priority value of _main() thread in windows?

hi all, I have a main program (C language)in visual studio 2005 which creates lot of threads.I have given pririty levels for them manually.But my program starts execution from _main() right. It is also a thread correct? Then i want to know the default priority of that main thread(NORMAL/ABOVE NORMAL /HIGHEST). Also can anybody please e...

Multithreaded single-reader single-writer fifo queue

I need a queue for passing messages from one thread (A) to another (B), however ive not been able to find one that really does what I want, since they generally allow adding an item to fail, a case which in my situation is pretty much fatal since the message needs to be processed, and the thread really cant stop and wait for spare room. ...

Does iframe runs on the same thread as the owner?

I have a CPU intensive work to do and i don't want to degrade the user experience. since web workers (http://ejohn.org/blog/web-workers/) are a new feature and are not supported by all browsers, i thought to open an iframe with an HTML + JS that will do all the dirty work and using some cross-domain communications to pass on the results....

Threading a member function inside a vector of classes

Hello, consider this: class MyClass { public: void DoSomething() { }; }; std::vector<MyClass> A; int main(int argc, char* const argv[]) { MyClass a; A.push_back(a); boost::thread newThread(&MyClass::DoSomething, &A.back()); } It compiles, but, expectedly, it does not work. Any help? ...

Cannot pass string to CreateThread receiver

I have a thread function that looks something like this: DWORD WINAPI Thread_ProcessFile( LPVOID lpParam ) { char *filename = (char*)lpParam; printf( "%s\n", filename ); } I also have a class that calls CreateThread and uses the above function for the routine address: void CMyClass::ProcessFile( void ) { HANDLE tHwnd = 0; char s...

How many threads does Qt create to work in the background?

Hi, I use qt a lot. I want to know something: how many threads does Qt create do to things in the background? like handling signals and slots.. Also, any GUI toolkit creates Event threads too (i seem to remember java does). Does Qt create one too? EDIT: when I say "how many threads", I really mean which threads Thanks, jrh ...