pthreads Questions

2

I'm using gdb 7.4.1 on embedded powerpc target to perform some analysis on my multi-threaded C++ program that uses pthreads. My end goal is to script gdb with python to automate some common analysi...
Castaneda asked 15/5, 2012 at 18:52

4

Solved

Is it possible to perform an asynchronous wait (read : non-blocking) on a conditional variable in boost::asio ? if it isn't directly supported any hints on implementing it would be appreciated. I ...

3

Solved

The man page for nice says "nice() adds inc to the nice value for the calling process. So, can we use it to change the nice value for a thread created by pthread_create? EDIT: It seems that we...
Staciastacie asked 7/10, 2011 at 7:46

3

Solved

I'm writing a client/server program in C. My client has a thread reading input from stdin, it's just a while(1) loop to read input from stdin. Whenever it reads a line, it deliver it to another th...
Gamin asked 3/2, 2017 at 1:14

6

Solved

I am creating a program with multiple threads using pthreads. Is sleep() causing the process (all the threads) to stop executing or just the thread where I am calling sleep?
Guimar asked 3/9, 2010 at 4:44

5

The pthread_mutex_timedlock documentation says that abs_timeout takes a CLOCK_REALTIME. However, we all know that it is inappropriate for timing a specific duration (due to system time adjustments)...
Laky asked 9/1, 2013 at 23:0

4

Solved

Is the behavior of this code well-defined? #include <stdio.h> #include <pthread.h> pthread_t mt; void *start(void *x) { void *y; pthread_join(mt, &y); printf("joined main thre...
Teressaterete asked 19/11, 2010 at 18:31

3

I'm just trying to understand a concept used by g++. Here my very simple std::thread application: #include <iostream> #include <thread> void func() { std::cout << "Running..." ...
Gelatin asked 28/10, 2017 at 22:8

5

Solved

I'm creating a multi-threaded application in C using Linux. I'm unsure whether I should use the POSIX thread API or the OpenMP API. What are the pros & cons of using either? Edit: Could som...
Croupier asked 16/10, 2010 at 17:16

8

Solved

I would like to call pthread_join for a given thread id, but only if that thread has been started. The safe solution might be to add a variable to track which thread where started or not. However, ...
Pereira asked 8/6, 2011 at 9:49

4

Solved

I have this object that contains a thread. I want the fate of the object and the fate of the thread to be one in the same. So the constructor creates a thread (with pthread_create) and the destruct...
Zermatt asked 14/2, 2014 at 4:48

3

Solved

I want to use a mutex which will be used to synchronize access to some variables residing in the memory shared b/w two different processes. How can I achieve that. Code sample to perform that will ...
Bulrush asked 25/6, 2011 at 11:47

12

Solved

In a Linux C program, how do I print the thread id of a thread created by the pthread library? For example like how we can get pid of a process by getpid().
Varix asked 13/1, 2014 at 12:12

4

Solved

I am just a beginner in Programming using C.For my college project I want to create a multi-threaded server application to which multiple clients can connect and transfer there data which can be sa...
Rape asked 28/1, 2016 at 12:43

4

I am a novice in thread programming. So my apologies for this seemingly stupid question. I am trying to create a POSIX thread using pthread_create() using pthread_attr_t. I am trying to set the sc...
Mighty asked 20/2, 2013 at 20:53

2

I'm writing a C++ ThreadPool implantation and using pthread_cond_wait in my worker's main function. I was wondering how much time will pass from signaling the condition variable until the thread/th...
Barracks asked 20/8, 2017 at 15:23

16

I picked up the following demo off the web from https://computing.llnl.gov/tutorials/pthreads/ #include <pthread.h> #include <stdio.h> #define NUM_THREADS 5 void *PrintHello(void *thr...
Vernita asked 2/11, 2009 at 18:40

1

I'm trying to use the C11 standard threading in my program, and I'm using the Mingw-w64 toolchain x86_64-8.1.0-posix-seh-rt_v6-rev0 specifically. When I #include <threads.h> as the C11 stand...
Maremma asked 8/9, 2018 at 21:45

5

I'm trying to run this simple thread c++ program in CLion #include <iostream> #include <thread> using namespace std; //Start of the thread t1 void hello() { cout << "Hello,c...
Wreckfish asked 9/8, 2017 at 22:50

3

Solved

Pretty self explanatory question. For example, the header for pthread_create shows it takes a pointer to a thread: int WINPTHREAD_API pthread_create(pthread_t *th, const pthread_attr_t *attr, void ...
Health asked 6/2, 2022 at 21:34

3

Solved

I am working on some code which uses the pthread and semaphore libraries. The sem_init function works fine on my Ubuntu machine, but on OS X the sem_init function has absolutely no effect. Is there...
Lucilla asked 11/9, 2009 at 23:57

2

I'm compiling a project that uses pthreads with gcc (g++ exactly) on cygwin. Seeing as how I have always developed this on linux, I never had any problems. But right now, I am unable to compile c...
Anachronistic asked 1/7, 2016 at 7:35

5

Solved

This looks like a duplicate of How do I abort a socket.recv() from another thread in Python, but it's not, since I want to abort recvfrom() in a thread, which is UDP, not TCP. Can this be solved b...
Comparator asked 16/9, 2011 at 19:3

5

Solved

I have written a small class for synchronizing threads of both Linux (actually Android) and Windows. Here is the Win32 implementation of my interface : class SyncObjectWin32 : public SyncObject ...
Furlough asked 13/10, 2015 at 9:3

4

Solved

There are many threads created in my application. some of the threads name are visible in the gdb while i execute the command 'info threads', others are not displayed. How to get all the thread nam...
Supernatant asked 20/1, 2012 at 16:1

© 2022 - 2024 — McMap. All rights reserved.