05-30-2012
Thanks, but what do you mean by "read cancellation point?"
One other matter, my tests show that if, by chance, the thread no longer exists when I call pthread_cancel, the parent will abend with a segfault. What signal might I trap with signal() to prevent this?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a written a script in korn shell for importing data into a oracle database. The shell invokes the import within the script. I want to kill this import (child process) . I tries using trap, but this does not kill the import even if i press cnt c. i have to login into other terminal... (2 Replies)
Discussion started by: yerics
2 Replies
2. Shell Programming and Scripting
I am calling another script from my main script and making it run in the background,based upon the value of the input provided by the user I want to kill the child process ,I have written this code
timer.ksh &
PID=$$
print "\n Do you wish to continue .. (Y/N) : \c "
read kill_proc
if ]... (4 Replies)
Discussion started by: mervin2006
4 Replies
3. Shell Programming and Scripting
I have a script that (ideally) starts tcpdump, sleeps a given number of seconds, then kills it.
When I do this for 10 seconds or and hour, it works fine. When I try it for 10 hours (the length I actually want) it just doesn't die, and will actually stick around for days.
Relevant part of my... (1 Reply)
Discussion started by: upnix
1 Replies
4. UNIX for Advanced & Expert Users
Hi,
Is there a way I can kill all the child processes of a process, given its process id.
Many thanks in advance.
J. (1 Reply)
Discussion started by: superuser84
1 Replies
5. UNIX for Advanced & Expert Users
Hi all,
I am writing a script which calls other third party scripts that perform numerous actions. I have no control over these scripts.
My problem is, one of these scripts seems to execute and do what it is meant to do, but my calling / parent script always exits at that point. I need to... (4 Replies)
Discussion started by: mark007
4 Replies
6. Solaris
Hi All
I have a separate thread ListenerThread having a socket listening to info broadcasted by some remote server. This is created in my main thread.
Because of requirements, once the separate thread is started I need to avoid any blocking function on the main thread. Once it comes to the... (2 Replies)
Discussion started by: manustone
2 Replies
7. Red Hat
Hi All,
Hope this is right area to ask this question.
I have a shell script (bash) "wrapper.sh", which contains few simple shell command
which executes a "server.sh" (conatins code to execute a java server) as a daemon.
Now what I want to kill this "server.sh" so that the server should... (2 Replies)
Discussion started by: jw_amp
2 Replies
8. Programming
Parent Thread Of Child Thread
Suppose a process creates some threads say threadC and threadD.
Later on each of these threads create new child threads say threadC1, threadC2, threadC3 etc. So a tree of threads will get created.
Is there any way to find out the parent thread of one such... (1 Reply)
Discussion started by: rupeshkp728
1 Replies
9. Shell Programming and Scripting
I'm likely going to explain this clumsily, so apologies in advance:
I have the following script:
#!/bin/bash
pidPrefix="logGen"
checkPrime ()
{
if /sbin/ifconfig eth0:0|/bin/grep -wq inet;then isPrime=1;else isPrime=0;fi
}
killScript ()
{
/usr/bin/find /var/run -name... (4 Replies)
Discussion started by: DeCoTwc
4 Replies
10. Solaris
Hello,
A little background on what we are doing first. We are running several applications from a CLI, and not all of them are fully functional. They do on occasion core dump, not a problem. We are running a service that takes a screen scrape of those apps and displays them in a more user... (5 Replies)
Discussion started by: Bryan.Eidson
5 Replies
LEARN ABOUT HPUX
pthread_cancel
pthread_cancel(3T) pthread_cancel(3T)
NAME
pthread_cancel() - cancel execution of a thread
SYNOPSIS
PARAMETERS
thread Target thread to be canceled.
DESCRIPTION
requests that thread (hereby referred to as target thread) be canceled. It allows a thread to terminate the execution of any thread in the
process in a controlled manner.
The target thread's cancelability state and type determine when the cancellation takes effect. Cancellation only occurs when the target
thread's cancelability state is When the target thread's cancelability state is cancellation requests against the target thread are held
pending and will be acted upon when cancellation is enabled.
When the cancelability type is for the target thread, new or pending cancellation requests are acted upon at any time. When the target
thread's cancelability type is cancellation requests are held pending until the target thread reaches a cancellation point (see below).
If the target thread's cancelability state is disabled, the cancelability type does not matter. When cancelability is enabled, the cance-
lability type will take effect.
When the cancellation is acted on, the cancellation cleanup handlers for thread are called. The cancellation cleanup handlers are called
in the opposite order in which they were installed. When the last cancellation cleanup handler returns, the thread-specific data destruc-
tor functions for thread are called. When the last destructor function returns, thread shall be terminated.
The caller of will not wait for the target thread to be canceled.
Cancellation Points
are points inside of certain functions where a thread must act on any pending cancellation request when cancelability is enabled if the
function would block.
RETURN VALUE
Upon successful completion, returns zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
For each of the following conditions, if the condition is detected, the function returns the corresponding error number:
[ESRCH] No thread could be found corresponding to thread.
WARNINGS
Use of asynchronous cancelability while holding resources that need to be released may result in resource loss. Applications must care-
fully follow static lexical scoping rules in their execution behavior. For instance, the use of return, goto, etc., to leave user-defined
cancellation scopes without doing the necessary scope pop will result in undefined behavior.
AUTHOR
was derived from the IEEE POSIX P1003.1c standard.
SEE ALSO
pthread_exit(3T), pthread_join(3T), pthread_setcancelstate(3T), pthread_cleanup_pop(3T), pthread_cond_wait(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_cancel(3T)