pthread (253)


C++ Thread question-setting a value to indicate the thread has finished

C++ Thread question-setting a value to indicate the thread has finished

Is the following safe? I am new to threading and I want to delegate a time consuming process to a separate thread in my C++ program. Using the boost libraries I have written code something like this:…


pthread_cond_wait versus semaphore

What are the pros/cons of using pthread_cond_wait or using a semaphore ? I am waiting for a state change like this:pthread_mutex_lock(&cam->video_lock); while(cam->status== WAIT_DISPLAY){p…


Non-blocking pthread_join

I'm coding the shutdown of a multithreaded server.If everything goes as it should all the threads exit by their own, but there's a small chance that a thread gets stuck.In this case it would be conve…


Using C/Pthreads: do shared variables need to be volatile?

In the C programming language and Pthreads as the threading library; do variables/structures that are shared between threads need to be declared as volatile? Assuming that they might be protected by…


linux - Setting the thread/proc/PID/cmdline?

On Linux/NPTL, threads are created as some kind of process. I can see some of my process have a weird cmdline: cat/proc/5590/cmdline hald-addon-storage: polling/dev/scd0(every 2 sec) Do you have…


How to determine optimal thread stack size?

Actually, two sizes: initially committed and total reserved. Do you use static or dynamic analysis? Which tools? Which techniques?…


pthread-like windows manual-reset event

is there any easier solution in porting a windows manual-reset event to pthread, than a pthread conditional-variable+pthread mutex+a flag if event is set or unset?…


How to join a thread that is hanging on blocking IO?

I have a thread running in the background that is reading events from an input device in a blocking fashion, now when I exit the application I want to clean up the thread properly, but I can't just r…


Concurrent programming c++?

I keep on hearing about concurrent programing every where. Can you guys throw some light on what it's and how c++ new standards facilitate doing the same?…



linux - What libraries need to be linked for timer_create, timer_settime and other timer related functions

Compiling a program on Linux that calls POSIX timer functions(eg: timer_create, timer_settime) returns errors such as: In function `foo': timer.c:(.text+0xbb): undefined reference to `timer_create'…




example linux thread threads mutex multithreading pthread_create pthreads tutorial how