pthreads Questions

4

Solved

I read that pthread is C library and is not compatible with C++ object model, especially when talking about exception handling. So I wish to know on linux system, how gcc/clang implements std::thr...
Condyloma asked 11/8, 2017 at 10:16

2

Solved

I'm learning pthread and came across reader writer lock. The scenario is very simple; a global variable being shared by all the threads, reader keeps printing the current value of that same global ...
Aedile asked 20/10, 2013 at 20:44

3

Solved

I'm doing some event handling with C++ and pthreads. I have a main thread that reads from event queue I defined, and a worker thread that fills the event queue. The queue is of course thread safe. ...
Kitchenette asked 4/9, 2013 at 12:44

4

Solved

Condition variables are generally used such that the state they refer to is modified under a mutex. However, when the state is just a single set-only flag, there's no need for a mutex to prevent si...
Interglacial asked 29/8, 2011 at 19:29

11

Solved

I have c++ project that was smoothly running on a given machine, and now I am trying to compile it on another one with the same operating system (Xubuntu 14.04). I've installed all the dependencie...
Spleenful asked 11/8, 2015 at 17:44

6

Solved

I have the following functions : void *foo(void *i) { int a = (int) i; } int main() { pthread_t thread; int i; pthread_create(&thread, 0, foo, (void *) i); } At compilation, there are s...
Accent asked 7/10, 2013 at 19:27

7

As per pthread_key_create man page we can associate a destructor to be called at thread shut down. My problem is that the destructor function I have registered is not being called. Gist of my code ...
Binky asked 2/7, 2014 at 2:28

3

Two threads in same process using rwlock object stored in shared memory encounter crash during pthreads stress test. I spent a while trying to find memory corruption or deadlock but nothing so far....
Migraine asked 27/3, 2017 at 2:9

5

I want to create a C++11 std::thread which I want it to run on my first core. I find that pthread_setaffinity_np and sched_setaffinity can change the CPU affinity of a thread and migrate it to the ...
Messily asked 9/7, 2014 at 5:19

11

Solved

I'am new to C and would like to play with threads a bit. I would like to return some value from a thread using pthread_exit() My code is as follows: #include <pthread.h> #include <stdio.h&...
Caliche asked 12/2, 2010 at 11:33

4

I'm developing a multi-threaded application for a Linux embedded platform. At the moment I'm setting the stack size for each thread (via pthread_set_attr) to a fairly large default value. I would l...
Coheman asked 12/9, 2008 at 10:19

6

Solved

I'm really uncertain about the requirements POSIX places on the safety of fork in the presence of threads and signals. fork is listed as one of the async-signal-safe functions, but if there is a po...
Denunciation asked 15/12, 2010 at 19:8

4

I can see number of threads used in application by going to /proc/$(pidof task)/ and giving cat status. Is there any way to check individual thread priority in linux using commands? Regard...

2

Solved

I am new to using pthread and also not that familiar with pointers to pointers. Could somebody perhaps explain why the second argument of pthread_join() is a void **. Why is it designed like this. ...
Busra asked 10/11, 2017 at 11:48

4

Solved

I have a problem about main threads and other threads in the same process. When the main function returns, do the other threads exit too? I am confused about this. Consider the following test code...
Shwalb asked 9/8, 2012 at 2:28

5

Solved

Why should I prefer one or another in practice? What are the technical differences except that std::thread is a class?
Unwearied asked 30/10, 2012 at 7:3

6

Solved

To quote the man page: When using condition variables there is always a Boolean predicate involving shared variables associated with each condition wait that is true if the thread should proceed...
Estren asked 21/12, 2011 at 18:30

5

Solved

I am trying to spawn threads with SCHED_FIFO or SCHED_RR policies as root on a Linux system but my calls to pthread_create() are returning 1 (EPERM). The man page for pthread_create() says that EPE...
Zambia asked 16/2, 2012 at 14:52

4

Solved

I have a problem creating a thread as detached. Here's the code I wrote: void* testFunction() { pthread_attr_t attr; int chk,rc; pthread_attr_init(&attr); printf("thread_attr_init: %d\n",r...
Rambow asked 1/6, 2011 at 14:25

4

I've installed Haskell Platform version 8.2.2 (Full, 64 bit) on Windows 10. ghc works, and also WinGHCi. There are several problems: -- Running ghci in cygwin gives this error: GHCi, version 8.2.2...
Frances asked 3/4, 2018 at 19:7

1

I have Linux with 6 CPU cores, one of which (0st) is isolated from Linux scheduler through the grub config file(/etc/default/grub) with GRUB_CMDLINE_LINUX_DEFAULT="quiet isolcpus=0 nohz_full=1...
Wintergreen asked 28/6, 2023 at 13:24

7

I want to suspend pthreads but apparently, there is no such function as pthread_suspend. I read somewhere about suspending pthreads using mutexes and conditions and used it as following: #include ...
Pricilla asked 29/6, 2010 at 13:5

4

Solved

I wrote this for an OS class assignment that I've already completed and handed in. I posted this question yesterday, but due to "Academic Honesty" regulations I took it off until after the submissi...
Holloman asked 5/3, 2015 at 22:7

5

Solved

I use the MinGW-w64 g++ compilers 10.2 and 10.3. I have built both myself using https://github.com/niXman/mingw-builds. There is an oddity with g++ on Windows: the main thread of an application wil...
Wellwisher asked 4/5, 2021 at 10:12

5

Solved

I'm asking about linux with recent glibc. Is there a way to detect that process consist of 1 thread or of several threads? Threads can be created by pthread, or bare clone(), so I need something ...
Steele asked 8/11, 2010 at 16:38

© 2022 - 2024 — McMap. All rights reserved.