What does "_np" suffix mean here:
pthread_mutex_timedlock_np
or in macros
PTHREAD_MUTEX_TIMED_NP
Upd:
From glibc2.2
enum
{
PTHREAD_MUTEX_TIMED_NP,
PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_ADAPTIVE_NP
#ifdef __USE_UNIX98
,
PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
PTHREAD_M...
Hello
If you don't know what is futex and linuxthreads-0.9, please, don't reply.
Can I mix in one program futex-based mutex with mutex from linuxthreads-0.8 or -0.9 (which was used in all glibc <=2.2 and in all uClibc) ?
I need interprocess mutex (pshared one, PTHREAD_PROCESS_SHARED).
So, If threads are started and managed by linuxth...
Hello,
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>
void *myThread()
{
int ret = 42;
pthread_exit(&ret);
}
int main()
{
pthread_t tid;
void *status;
pthread_create(&tid, NULL...
Can threads have more than one argument without using a struct?
So... kind of like:
pthread_create(&file_thread, NULL, merge_thread, sortedFiles, number);
... where 'number' is the extra argument?
Thanks,
Hristo
...
Thread is "lightweight" because most of the overhead has already been accomplished through the creation of its process.
I found this in one of the tutorial.
Can somebody eloberate what it exactly means?
...
I have a number of data containers that can send a signal when there are updates in them. The structure looks similar like this:
typedef struct {
int data;
/*...*/
pthread_cond_t *onHaveUpdate;
} Container;
The onHaveUpdate is a pointer to a global condition that is shared by all the containers
In my application, I have a numbe...
Let's say I have a python script which loads a shared library (SL) through ctypes.
The SL sets up a pthread T1
The python script configures callbacks through the SL i.e. python script calls functions from the SL with references to python callables
Now, let's say T1 calls a "callback" function, are the following assumptions true:
...
I've googled for the error above; no use.
This error comes form the following line of code:
void Thread::join(void** status) {
pthread_join(thread, status);
}
Anyone has any idea what it means?
(Google brings up other ppl complainig about the error, but no explaingion of it).
...
Hello
Which types of mutex does bionic libc support?
recursive
timed
adaptive
errorchecking
...
I am running the same exact code that I ran in plain C:
pthread_create(&threads[i], &attr, SomeMethod, ptrChar);
And I get the errors:
error: invalid conversion from
'void*(*)(char'*)' to 'void*(*)(void*)'
error: initializing argument 3 of 'int
pthread_create(__pthread_t**,
__pthread_attr_t* conts*, void*(*)(void*), voi...
Hi
I have a libpthread linked application. The core of the application are two FIFOs shared by four threads ( two threads per one FIFO that is ;). The FIFO class is synchronized using pthread mutexes and it stores pointers to big classes ( containing buffers of about 4kb size ) allocated inside static memory using overloaded new and del...
Hi
I need to fire of a bunch of threads and would like to bring them down gracefully.
I'm trying to use pthread_cond_signal/pthread_cond_wait to achieve this but am running into a problem.
Here's my code. firstly the thread_main
static void *thrmain( void * arg )
{
// acquire references to the cond var, mutex, finished flag and
...
Hi, guys. I have a question about the stack size of a process on Linux. Is this stack size determined at linkage time and is coded in the ELF file? I wrote a program which print its stack size by pthread_attr_getstacksize(&attr, &stacksize);. And if I run this program directly from shell, it gives a value of about 10MB. But when I exec i...
I'm using C and pthread on a Linux machine, and I'm having trouble parallelizing a program.
I'm basically trying to take in a folder of data files, divide them into groups, each group handled by a thread, and run a function on each of the data file.
The way I'm doing this is I have a global char **filename variable, where filename[i] ...
I've written some pthread code that use timed waits on a condition variable but in order to ensure a relative wait I've set the condvar's clock type to CLOCK_MONOTONIC using pthread_condattr_setclock().
In order to compile and link pthread_condattr_setclock() on RHEL4, i've had to add -I/usr/include/nptl and -L/usr/lib/nptl to my gcc co...
Hey all -
I'm writing a multi-threaded demo program using pthreads, where one thread loads data into an STL queue, and another thread reads from it. Sounds trivial, right? Unfortunately, data pushed into the queue is vanishing. I'm not new to multithreading, nor am I unfamiliar with memory structures - however, this has me stumped.
...
Hi all,
I'm having some problems with my program in VS .NET 2003.
I initially wrote a module that uses the pthread library to create a number of threads to process something. This runs correctly in VS .NET 2003. Then this module was used by someone else and integrated into another larger program. I'm not sure about the details, but th...
Is there any way of setting the name of a thread in linux ?
My main purpose is it would be helpful while debugging, and also nice if that name was exposed through /proc/
...
I found this:
http://stackoverflow.com/questions/2284730/fast-interprocess-synchronization-method
I used to believe that a pThread mutex can only be shared between two thraeds in the same address space.
The question / answers there seems to imply:
If I have two separate proceses A & B. They ahve a shared memory region M. I can put a p...
I'm switching over from g++ to clang
however, in g++, I have the -pthread flag, which clang does not seem to recognize.
What is the equiv in clang?
EDIT: My clang build is pulling from svn on March 5 2010.
...