Skip to content
Advertisement

Tag: multithreading

pthread_cancel and cancellation point

I’m learning the pthread_cancel function and testing whether thread would be cancelled when it doesn’t reach cancellation point. Thread is created by default attribute and make it running in add loop. But when cancellation request was sent and thread exit immediately. It doesn’t reach cancellation point and I think it should not respond to the request immediately. Answer To have

Linux – Get the start and end of the stack memory for a thread

I am trying to port something to Linux. My original code (for a RTOS) looks like: Later the stack and stackSize are used by the garbage collector and to get some thread statistics. Now, how do I convert the above code to Linux? Answer You should use Pthread: http://www.manpagez.com/man/3/pthread_attr/ http://www.manpagez.com/man/3/pthread_create/

linux: sigwait() takes precedence over pthread_sigmask(SIG_UNBLOCK)?

In a program, SIGCHLD is blocked from main thread, then thread “THREAD_1” is doing sigwait(), thread “THREAD_2” which forks a child process and kills it, in this thread I called pthread_sigmask(SIG_UNBLOCK, &set, 0) to unblock SIGCHLD before killing the child. But SIGCHLD is still being picked up by sigwait(). Other than unblock SIGCHLD from main() before creating threads, is there

Why is a multithreaded C program forced to a single CPU on Mac OS X when system() is used in a thread?

I encountered a strange difference in the behavior of a program using pthreads between Linux and Mac OS X. Consider the following program that can be compiled with “gcc -pthread -o threadtest threadtest.c”: Running the resulting executable on a 4-core Mac OS X machine results in the following behavior: Note that the number of actual cores is probably not even

C++ std::thread “Attempt to use a deleted function”

Here’s the relevant code and the relevant error, I’m not really sure what to make of it. That’s in thread.cpp, the next is in log.cpp… and Here’s the relevant error: Answer I think the problem is the declaration of the parameter func. It is declared as a void pointer instead of a pointer to a function returning void. Instead of,

Is iptables thread safe?

This seems to me to be a basic question, but google and SO fail to give me an answer. As the title says, is iptables thread safe? If I have multiple processes making calls to iptables, should I create a lock for myself? There seems to be some threads from 2009 querying if netfilter is thread-safe, with no solid resolution.

Kill python thread using os

I’ve already asked similar question many times, but still can’t find appropriate solution. I have and external function, that could run in some cases very long. I want to interrupt it after, say, 30 seconds. How do I do that? Threads are good, but I can’t stope them (i don’t have access to external function’s code) Multiprocessing is also not

Advertisement