11-15-2010
1. So you can return whatever type you want.
2. Again So you can pass what ever argument to the thread function.
This User Gave Thanks to majid.merkava For This Post:
9 More Discussions You Might Find Interesting
1. Programming
Here is simple code for multithreading in POSIX:
void* simplethread(void* arg)
{
printf("Hello World\n");
}
int main(void)
{
pthread_t id;
pthread_create(&id, NULL, simplethread, NULL);
return 0;
}
Whether the new thread will run or not depends on the OS. Tricky ... (5 Replies)
Discussion started by: _rocky
5 Replies
2. Programming
how to do with that?
after cc -o xxxx xxxx.c
ld:
Unresolved:
_pthread_create
_pthread_deteach
_pthread_exit
Thanks (3 Replies)
Discussion started by: zhshqzyc
3 Replies
3. Programming
Hello
My problem goes like this:
I have used Pthread_create, and I have tryed to create 2 proccess but nothing happens! It does not even matter what the function im trying to create do. It is if im trying to activate an empty function. This is my code.
Any help will be highly appreciated.... (1 Reply)
Discussion started by: Hellboy
1 Replies
4. Programming
Hi.
I use C++ and I wishes to create a thread with the pthread_create function, my question is, how can I do this if I wish that the function will be a member of the class ??
I know from windows programming that I can declare a static function like this
static unsigned int __stdcall... (7 Replies)
Discussion started by: shvalb
7 Replies
5. Solaris
Im trying to run an application i compiled (iperf) and i get an error telling me that it cant create the pthread. when i ran the ./configuration one of the things it checked was for pthreads which came back ok.
Im not really sure where to even start to resolve this. i have been unable to find... (5 Replies)
Discussion started by: jrich523
5 Replies
6. Programming
I try to compile a sample c code in fedora eclipse 3.2 as managed makefile using pthread library,it shows some error on pthread functions.Error is of undefined reference to pthread.Anybody guide me to solve this problem.
Thanking you (1 Reply)
Discussion started by: sujith4u87
1 Replies
7. Programming
Hi guys.
H was learning posix threads in C with anjuta IDE. it gives me
undefined reference to `pthread_create'
I know i should compile it like:
gcc -lpthread main.c
how should i import this configuration in anjuta so i can compile inside it? (2 Replies)
Discussion started by: majid.merkava
2 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I'm trying to do my homework assignment but I am having trouble using the pthread_create fucntion.
Here is my code________________
//Alicia Johnson
//sum_pid program
//creates n number of threads. These threads create a random number
//then adds the number to a global array. Then... (1 Reply)
Discussion started by: ajohns38
1 Replies
9. Programming
Suppose I have a simple program main() with a global varibale int x=0.
int x = 0;
main()
{
print("%d\n",x);
}
I want to create two threads/process which must access this variable x in sync.
Which one will be better threads( pthread_create ) or process( fork )?
If I go with fork() then... (1 Reply)
Discussion started by: rupeshkp728
1 Replies
LEARN ABOUT OSF1
pthread_detach
pthread_detach(3) Library Functions Manual pthread_detach(3)
NAME
pthread_detach - Marks a thread object for deletion.
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h>
int pthread_detach(
pthread_t thread);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
PARAMETERS
Thread object being marked for deletion.
DESCRIPTION
This routine marks the specified thread object to indicate that storage for the corresponding thread can be reclaimed when the thread ter-
minates. This includes storage for the thread argument's return value, as well as the thread object. If thread has not terminated when
this routine is called, this routine does not cause it to terminate.
When a thread object is no longer referenced, call this routine.
The results of this routine are unpredictable if the value of thread refers to a thread object that does not exist.
A thread can be created already detached by setting its thread object's detachstate attribute.
The pthread_join(3) routine also detaches the target thread after pthread_join(3) returns successfully.
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The value specified by thread does not refer to a joinable thread. The value specified by thread cannot be found.
ERRORS
None
RELATED INFORMATION
Routines: pthread_cancel(3), pthread_create(3), pthread_exit(3), pthread_join(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_detach(3)