10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition.
#Body
function1()
{
if
then
echo "exist"
else
echo "not exist"
}
#if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
2. Shell Programming and Scripting
Dear All.
I have a script, which process files one by one. In the script I have two functions.
one sftp files to different server
the other from existing file create file with different name.
My question is:
Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies
3. Shell Programming and Scripting
I have a script which does gunzip, zip and untar.
Input to the script is file name and file directory (where file is located)
I am reading the input parameters as follows:
FILENAME=$1
FILEDIR=$2
I have created 3 functions that are as follows:
1) gunzip file
2) unzip file... (2 Replies)
Discussion started by: pinnacle
2 Replies
4. Programming
In gdb, I can call one function with command "call", but how can I step in the function? I don't want to restart the program, but the function had been executed, gdb will execute next statement, and I don't know how to recall the function. (4 Replies)
Discussion started by: 915086731
4 Replies
5. Programming
Hi...
this simple code has warning messages but it work..
void *th(void *g){
int y = 10;
pthread_exit((void*)y);
}
int main(int argn, char ** argp){
void * ret;
pthread_t thread;
pthread_create(&thread, NULL, th, NULL);
pthread_join(thread,... (10 Replies)
Discussion started by: prompt
10 Replies
6. Shell Programming and Scripting
This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord
but only one record is getting wrote in DB.... Please advise ASAP...:confused:
function InsertFtg
{
FTGSTR=""
echo "Saurabh is GREAT $#"
let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies
7. Programming
Main function creates Thread0 and Thread1 by using pthread_create systemcall.
In Thread0() {
we are calling pthread_exit(0) ;
}
and in Thread1() {
status= pthread_join(tid,NULL);
sprintf(ebuf,"timer6: can't join with thread0, status: %d",status);
Assert(status==0,ebuf);
}
... (4 Replies)
Discussion started by: mansa
4 Replies
8. Linux
Hello All,
The problem i'm experiencing is with the following code:
#include <pthread.h>
#include <stdio.h>
int main(void)
{
(void) pthread_join(155555, NULL);
printf("done");
return 0;
}
I'm getting on terminal segmentation fault .
System used:... (0 Replies)
Discussion started by: crocodil
0 Replies
9. Shell Programming and Scripting
Hi ,
I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .
sars (4 Replies)
Discussion started by: sars
4 Replies
10. UNIX for Dummies Questions & Answers
I would like to write my own version of pthread_join and some of the other pthread function. Does some know any pages that have som examples of doing this?? (1 Reply)
Discussion started by: bigblop
1 Replies
PTHREAD_JOIN(3) BSD Library Functions Manual PTHREAD_JOIN(3)
NAME
pthread_join, pthread_timedjoin_np -- wait for thread termination
LIBRARY
POSIX Threads Library (libpthread, -lpthread)
SYNOPSIS
#include <pthread.h>
int
pthread_join(pthread_t thread, void **value_ptr);
int
pthread_timedjoin_np(pthread_t thread, void **value_ptr, const struct timespec *abstime);
DESCRIPTION
The pthread_join() function suspends execution of the calling thread until the target thread terminates unless the target thread has already
terminated.
On return from a successful pthread_join() call with a non-NULL value_ptr argument, the value passed to pthread_exit() by the terminating
thread is stored in the location referenced by value_ptr. When a pthread_join() returns successfully, the target thread has been terminated.
The results of multiple simultaneous calls to pthread_join() specifying the same target thread are undefined. If the thread calling
pthread_join() is cancelled, then the target thread is not detached.
The pthread_timedjoin_np() function is equivalent to the pthread_join() function except it will return ETIMEDOUT if target thread does not
exit before specified absolute time passes.
A thread that has exited but remains unjoined counts against [_POSIX_THREAD_THREADS_MAX].
RETURN VALUES
If successful, the pthread_join() and pthread_timedjoin_np() functions will return zero. Otherwise an error number will be returned to indi-
cate the error.
ERRORS
The pthread_join() and pthread_timedjoin_np() functions will fail if:
[EINVAL] The implementation has detected that the value specified by thread does not refer to a joinable thread.
[ESRCH] No thread could be found corresponding to that specified by the given thread ID, thread.
[EDEADLK] A deadlock was detected or the value of thread specifies the calling thread.
[EOPNOTSUPP] The implementation detected that another caller is already waiting on thread.
Additionally, the pthread_timedjoin_np() function will fail if:
[ETIMEDOUT] The specified absolute time passed while pthread_timedjoin_np() waited for thread exit.
SEE ALSO
wait(2), pthread_create(3)
STANDARDS
The pthread_join() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1''). The pthread_timedjoin_np() is a FreeBSD extension which first
appeared in FreeBSD 6.1.
BSD
January 23, 2010 BSD