10 More Discussions You Might Find Interesting
1. Programming
I have a while loop like so:
while (counter (file1));
how can I pass that into a pthread_create()?
I was thinking ...
while(pthread_create(&path, NULL, counter, file));
is that right? (1 Reply)
Discussion started by: l flipboi l
1 Replies
2. Programming
I have written a C code and when i compile it there are 0 warnings and 0 errors, but when i try to run apears:
./client: symbol lookup error: ./client: undefined symbol: pthread_create, version GLIBC_2.1
the part of the code where i have the pthread_creat is:
int serverConection(int... (5 Replies)
Discussion started by: SuperStout
5 Replies
3. Ubuntu
Hi all,
I wrote some code in c, using pthread (I configured the linker and compiler in eclipse IDE first).
#include <pthread.h>
#include "starter.h"
#include "UI.h"
Page* MM;
Page* Disk;
PCB* all_pcb_array;
void* display_prompt(void *id){
printf("Hello111\n");
return... (1 Reply)
Discussion started by: elad2109
1 Replies
4. UNIX for Advanced & Expert Users
I am so confused about the user threads and kernel threads.Suppose I created a thread using pthread create call in Linux ,whether it will be a user thread or kernel thread.If it user thread,then how its map to kernel thread.
I heard about the M:1,M:N,1:1 mapping methods.Which method linux is... (1 Reply)
Discussion started by: sujith4u87
1 Replies
5. Programming
problem solved
edited, sorry (1 Reply)
Discussion started by: joey
1 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I run my pthread code on Linux with 4 processors. However, the speed up is only 2 times.
The code is about solving equation (G+s(i)C)z(i)=B*us(i), i=1,...,n. Here G,C are m*m matrix, B*us(i) is a m*1 vector and s(i) are n different numbers. I need to solve the equation n times to... (2 Replies)
Discussion started by: mgig
2 Replies
7. Solaris
Hi all!
I am working on unix systems.I am programming in c.
I have got some problems with pthread.when I use pthread_create to creat a thread it says:
(.text+0x3a): undefined reference to `pthread_create'.
same is the problm with pthread_kill.
Can anyone help me out here.
Thanks.
vij. (2 Replies)
Discussion started by: vijlak
2 Replies
8. UNIX for Dummies Questions & Answers
When I use some of the pthread functions: pthread_join, pthread_exit they work perfect. But when I look in the pthread.h file I can't seem to find any implementations of the functions...where are they hiding?? (2 Replies)
Discussion started by: bigblop
2 Replies
9. Programming
hallo 2 al
can anyone pls tell me where and how can i find and install the pthread.h lib ?
thx :cool: (2 Replies)
Discussion started by: XinU*
2 Replies
10. Programming
Can someone point to a link where I can get good info about pthread?
thanx.. :) (1 Reply)
Discussion started by: jyotipg
1 Replies
PTHREAD_DETACH(3) Linux Programmer's Manual PTHREAD_DETACH(3)
NAME
pthread_detach - detach a thread
SYNOPSIS
#include <pthread.h>
int pthread_detach(pthread_t thread);
Compile and link with -pthread.
DESCRIPTION
The pthread_detach() function marks the thread identified by thread as detached. When a detached thread terminates, its resources are
automatically released back to the system without the need for another thread to join with the terminated thread.
Attempting to detach an already detached thread results in unspecified behavior.
RETURN VALUE
On success, pthread_detach() returns 0; on error, it returns an error number.
ERRORS
EINVAL thread is not a joinable thread.
ESRCH No thread with the ID thread could be found.
CONFORMING TO
POSIX.1-2001.
NOTES
Once a thread has been detached, it can't be joined with pthread_join(3) or be made joinable again.
A new thread can be created in a detached state using pthread_attr_setdetachstate(3) to set the detached attribute of the attr argument of
pthread_create(3).
The detached attribute merely determines the behavior of the system when the thread terminates; it does not prevent the thread from being
terminated if the process terminates using exit(3) (or equivalently, if the main thread returns).
Either pthread_join(3) or pthread_detach() should be called for each thread that an application creates, so that system resources for the
thread can be released. (But note that the resources of all threads are freed when the process terminates.)
EXAMPLE
The following statement detaches the calling thread:
pthread_detach(pthread_self());
SEE ALSO
pthread_attr_setdetachstate(3), pthread_cancel(3), pthread_create(3), pthread_exit(3), pthread_join(3), pthreads(7)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-11-27 PTHREAD_DETACH(3)