| | |
How to reuse pthreads in C
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2006
Posts: 68
Reputation:
Solved Threads: 0
hi all,
i have a problem with pthread programming.
function_1(){
.
.
rc = pthread_create(&thread, &attr, my_function, (void *)&my_data);
.
rc = pthread_create(&thread, &attr, my_function, (void *)&my_data);
.
}
As the above “function_1” do, the “my_function” can be executed any number of time according to our need, but the problem is I have to create threads again and again. I think this is useless, because the input parameters are same at always (do not have to change).
So i want to do this(execute “my_function” regularly) with a one thread which is created at very first. Is this possible..?
please anyone can help me..
i have a problem with pthread programming.
function_1(){
.
.
rc = pthread_create(&thread, &attr, my_function, (void *)&my_data);
.
rc = pthread_create(&thread, &attr, my_function, (void *)&my_data);
.
}
As the above “function_1” do, the “my_function” can be executed any number of time according to our need, but the problem is I have to create threads again and again. I think this is useless, because the input parameters are same at always (do not have to change).
So i want to do this(execute “my_function” regularly) with a one thread which is created at very first. Is this possible..?
please anyone can help me..
Make the thread sleep for some time and execute my_function or else wait for some message to arrive in a message queue and then execute the function my_function.
![]() |
Other Threads in the C Forum
- Previous Thread: system command not working in C functions.pls help
- Next Thread: operation on tape using st driver
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file fork forloop framework function functions givemetehcodez grade graphics gtkwinlinux hacking histogram homework include incrementoperators input intmain() iso kernel keyboard km lazy license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opensource overwrite owf pdf performance pointer posix problem probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming spoonfeeding standard string student systemcall testing threads turboc unix user variable wab whythiscodecausesegmentationfault windowsapi






