In your example, you wait for the termination of the BusyWork() thread (using pthread_join) in createThread(). But this thread never terminates because of the while(1) {...}
Hence you get never past the first createThread().
Cheers, Loïc
Hi, when I write the pthread_create() and pthread_join in this way, then the program is OK.
However, I require to design the architecture like
In my requirement, once some events or signals come, then a thread is created for handle it; if no events then no thread is created.
Hello,
J create a thread C with a JNI function via JAVA.
J have the following message (but not in each time):
Someone has an idea ?
Thank.
Unexpected Signal : 4 occurred at PC=0x78C103E0
Function=
Library=(N/A)
NOTE: We are unable to locate the function name... (0 Replies)
Discussion started by: AUBERT
0 Replies
2. Post Here to Contact Site Administrators and Moderators
I am unable to open the mimesender thread. I get the following message when clicking on https://www.unix.com/showthread.php?p=33233#post33233 : (2 Replies)
hi all,
my requirement is to create a thread by calling another function.
i.e i dont call pthread_create directly from main, but by calling another function (createThd - below ), from main.
Example:
void *thread_function(void *arg) { /* thread function */
int i;
rc =... (3 Replies)
Discussion started by: wolwy_pete
3 Replies
4. Forum Support Area for Unregistered Users & Account Problems
I try to initial a UDP client from threading, but it doesn't work? why?
These codes from the textbook
#define ECHOMAX 255 /* Longest string to echo */
#define TIMEOUT_SECS 2 /* Seconds between retransmits */
#define MAXTRIES 5 /* Tries before giving up */... (3 Replies)
As I know threads share the memory. But, what about the local variables in the thread function? if i call multiple threads would they allocate seperate local variables for themselves?
like
thread_func()
{
int i, j;
string...
}
Are the above local variables defined for each of... (1 Reply)
Hello,
I hope you can help me with my problem.
I've written a programm which creates a thread. The main programmm creates 10 int and float values. The fucnction should give the values out.
May big problem ist that the delivery to the function is not working.
Where ist my fault?
How can I make... (1 Reply)
Discussion started by: jimm_the_h
1 Replies
8. Forum Support Area for Unregistered Users & Account Problems
I am unable to post reply to a thread. Whenever I will reply to any post I get the message every time :
The message you have entered is too short. Please lengthen your message to at least 5 characters.
Even though length of the message is more than required.
for example I tried to post
... (3 Replies)
Discussion started by: Unregistered
3 Replies
9. Forum Support Area for Unregistered Users & Account Problems
Hi.
I registered, but when trying to post, I get ...
"Sorry, you do not have enough Bits to post a new thread"
Google & Forum search showed some hits, but no solution.
Please advide.
Thanks! (1 Reply)
Hi Experts,
Am writing a code which need to check for the previous day date and pickup the file as per the previous day date.
Problem: Why variable "YDATE" is empty ?
O/S: RHEL 5.6
Shell: BASH
Desired O/P: ls -lrt /opt/test/user/atsuser.NHU/out/demon.08272017
When I checked the... (3 Replies)
Discussion started by: pradeep84in
3 Replies
LEARN ABOUT OSF1
pthread_join
pthread_join(3) Library Functions Manual pthread_join(3)NAME
pthread_join - Causes the calling thread to wait for the termination of the specified thread.
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h>
int pthread_join(
pthread_t thread,
void **value_ptr);
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 whose termination is awaited by the calling routine. Return value of the terminating thread (when that thread either calls
pthread_exit(3) or returns from its start routine).
DESCRIPTION
This routine suspends execution of the calling thread until the specified target thread thread terminates.
On return from a successful pthread_join(3) call with a non-NULL value_ptr argument, the value passed to pthread_exit(3) is returned in the
location referenced by value_ptr, and the terminating thread is detached.
If more than one thread attempts to join with the same thread, the results are unpredictable.
A call to pthread_join(3) returns after the target thread terminates. The pthread_join(3) routine is a deferred cancelation point: the
target thread will not be detached if the thread blocked in pthread_join(3) is canceled.
If a thread calls this routine and specifies its own pthread_t, a deadlock can result.
The pthread_join(3) (or pthread_detach(3)) routine should eventually be called for every thread that is created with the detachstate
attribute of its thread attributes object set to PTHREAD_CREATE_JOINABLE, so that storage associated with the thread can be reclaimed.
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 does not refer to
an existing thread ID. A deadlock was detected, or thread specifies the calling thread.
ERRORS
None
RELATED INFORMATION
Functions: pthread_cancel(3), pthread_create(3), pthread_detach(3), pthread_exit(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_join(3)