pthreads Questions

5

Solved

I know calling fork() sys_call from a thread is a bad idea. However, what will happen if a thread creates a new process using fork()? The new process will be the child of the main thread that cr...
Dichlamydeous asked 6/10, 2016 at 7:45

4

Solved

Is there a way to get any kind of thread identifier of the currently running thread without resorting to Objective-C's NSThread. I'm improving our custom debug tracing system to handle multiple th...
Plough asked 8/10, 2009 at 21:27

3

According to proc manual: /proc/[pid]/stack (since Linux 2.6.29) This file provides a symbolic trace of the function calls in this process's kernel stack. This file is provided only if th...
Shuman asked 30/10, 2015 at 5:40

3

Solved

I found an implementation for pthreads on Windows here, but I couldn't get it to work right. Can anyone help me to install pthreads ? Like where to put DLLs, .lib, and .h files? Also, as an enviro...
Feoff asked 19/10, 2013 at 15:3

9

Solved

I need to pass multiple arguments to a function that I would like to call on a separate thread. I've read that the typical way to do this is to define a struct, pass the function a pointer to that,...
Gristmill asked 30/8, 2009 at 0:52

10

Solved

I am new to pthreads, and I am trying to understand it. I saw some examples like the following. I could see that the main() is blocked by the API pthread_exit(), and I have seen examples where th...
Vannie asked 29/12, 2013 at 10:35

6

I've been trying to familiarize myself with the std::thread library in C++11, and have arrived at a stumbling block. Initially I come from a posix threads background, and was wondering how does on...
Uird asked 14/12, 2012 at 2:17

4

Solved

I'm wondering if it is safe to call pthread_cancel() on a terminated thread. I couldn't find any hints in the manual page. Thanks in advance for any hints. Edit: Maybe I wasn't accurate enough. I'...
Virgulate asked 29/8, 2011 at 20:14

1

Solved

The cmake partial output looks like this: -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
Gismo asked 24/10, 2020 at 14:52

2

Solved

I'm using the Android NDK and Cmake to generate shared libraries of my project. I'm porting an existing project from Ubuntu to Android, and right now I need to port some executables files. I compi...
Equuleus asked 13/5, 2011 at 10:36

2

Solved

I'm trying to debug some performance issues with pthreads on Linux and I think sched_getcpu() may be lying to me. It reports a constant CPU for each thread, whereas profiling experiments seem to su...
Isochromatic asked 29/4, 2016 at 9:33

3

Solved

Generally speaking, pthread_cond_wait() and pthread_cond_signal() are called as below: //thread 1: pthread_mutex_lock(&mutex); pthread_cond_wait(&cond, &mutex); do_something() pthread_...
Marrowbone asked 13/5, 2013 at 13:7

3

Here is my environment: OS: Ubuntu 14.10 gcc: 4.9 cmake: 2.8, 3.1(both tried) project: muduo Recently, I've started to learn network programming and download muduo for learning. While I have p...
Invigilate asked 19/1, 2015 at 16:26

7

Solved

Can somebody please explain with examples (of code) what is the difference between deadlock and livelock?
Fulminant asked 27/5, 2011 at 17:52

2

Solved

What are the tradeoffs b/w boost::thread, std::thread (C++11), and pthread for high CPU throughput (read: lots of floating point operations) Linux based applications? When should one implementation...
Soot asked 2/9, 2020 at 11:56

4

Solved

I'm currently writing a simple webserver in C for a course I'm doing. One requirement is for us to implement a thread pool to handle connections using pthreads. I know how I would go about doing th...
Cleavage asked 26/2, 2011 at 0:55

7

Solved

It looks like some work has been done to make pthread-win32 work with x64, but there are no build instructions. I have tried simly building with the Visual Studio x64 Cross Tools Command Prompt, bu...
Wellspring asked 1/10, 2008 at 19:28

13

Solved

Searched, but don't come across a satisfying answer. I know there's no a portable way to print a pthread_t. How do you do it in your app? Update: Actually I don't need pthread_t, but some sm...
Dewie asked 18/11, 2009 at 23:8

2

Solved

I've been using the pthread library for creating & joining threads in C. When should I create a thread as detached, right from the outset? Does it offer any performance advantage vs. a joinab...
Bovine asked 21/9, 2010 at 2:22

0

UPDATE 1: This question has been updated to eliminate the multithreading, simplifying its scope. The original problem popened in the main thread, and pclosed the child process in a different thread...
Theravada asked 4/7, 2020 at 1:54

3

Solved

What is the difference between gcc -pthread and gcc -lpthread which is used while compiling multithreaded programs?

3

Solved

I have a capture program which in addition do capturing data and writing it into a file also prints some statistics.The function that prints the statistics static void report(void) { /*Print sta...
Minstrelsy asked 26/5, 2014 at 23:36

6

I'm trying to use pthreads for multithreading. I'm creating pool with constructor. First parameter is number of Workers. $pool = new Pool(8, 'WebWorker'); I want to detect count of processor cor...
Hassiehassin asked 1/5, 2016 at 18:20

1

Solved

I am trying to parallelize an algorithm in C. I want to use pthread_barrier_t but my Ubuntu wsl can't find it for some reason. I have pthread.h included and I can use the rest of the pthread functi...
Siccative asked 7/5, 2020 at 0:39

2

Solved

I am trying to include #include <pthread.h> in my project which uses CLion but I am cannot use it directly. Is there any specific way to include pthread to a C project?
Cysto asked 27/4, 2020 at 10:48

© 2022 - 2024 — McMap. All rights reserved.