Threads terminating when a signal is generated


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Threads terminating when a signal is generated
# 1  
Old 04-22-2009
Threads terminating when a signal is generated

hi all,

i had created 3 threads using pthreads. Each thread does a different job. Now the main problem is when one thread generates a signal (for example SIGFPE, SIGINT) then the process terminates and all other threads do terminate eventually.

I want to keep other threads running i.e, i want to keep the process.
Is there a way only to terminate only the thread that generated the signal?

thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Threads Terminating Abnormally.

I've used threads before, but not with Perl. I tried looking up these errors and using 'join' instead of 'detach' with no luck. Here is the code I am currently using: #!/usr/bin/perl -w use warnings; use threads; use threads::shared; $Linux='Linux'; $Greek='Greek'; my... (3 Replies)
Discussion started by: Azrael
3 Replies

2. Shell Programming and Scripting

Cd error terminating loop

Hi All, I am trying to make a small shell script.In this it will got directory as per variable & run the find command on that directory.There are 120 + directories & not sure all of them are mounted.So the issue is if the directory doesent exists my loops gets terminated. so is there any was... (3 Replies)
Discussion started by: ajaincv
3 Replies

3. Programming

Question (pthread): How to Signal all threads w/o "broadcast"?

Hello all, Is there any way that I can signal (wake) all threads that I have created without using pthread_cond_broadcast? Cheers! Aaron (6 Replies)
Discussion started by: mobility
6 Replies

4. Shell Programming and Scripting

How can i terminating expect script without terminating SSH connection.

Hi all , i know i ask a lot of question but these are really hard to solve and important question. I send two scripts: expect.sh: #!/usr/local/bin/expect spawn ssh root@172.30.64.163 expect "login:" send "root\n" expect "password:" send "root\n^M" interact and son.sh: ... (2 Replies)
Discussion started by: fozay
2 Replies

5. Shell Programming and Scripting

nohup terminating

hi all, i m running few batch process through shell script using nohup command but when session get terminated(due to network, reboot of desktop and closing session directly) all processes terminating abnormally and core file is generating. application batch process is connecting oracle... (4 Replies)
Discussion started by: arvindng
4 Replies

6. Shell Programming and Scripting

script unexpectedly terminating

I now that this isnt the greatest code around. Im a network guy by trade not a programer .. but needed something to compare config files ... Anyway ... intermittently, the program terminates. Ive been looking at the code for a week trying to figure it out and Im stumped. Can anyone provide... (0 Replies)
Discussion started by: popeye
0 Replies

7. HP-UX

Terminating Processes by Name

Hi! Just want to know if there is one command that I can use to kill processes by its name. Thanks. (1 Reply)
Discussion started by: love833
1 Replies

8. UNIX for Dummies Questions & Answers

Terminating child script with terminating the parent script

Hi I was working on a shell script with randomly shows a page of text from a randomly selected topic .As soon as the page is displayed it callers a timer script which keeps on running indefinitely until the timer script is killed by the user. This is where I have the problem,if I press... (2 Replies)
Discussion started by: mervin2006
2 Replies

9. Shell Programming and Scripting

terminating script with CTRL+D

Hi, I'm trying to make a script that reads the console input and terminates with CTRL+D. It's absolutely basic but I don't know how to "read" the CTRL+D. I've tried a bunch of things like EOT=^D while //with & without quotations do read input echo $input done while while ] ... (12 Replies)
Discussion started by: sanchopansa
12 Replies

10. UNIX for Dummies Questions & Answers

Terminating myself

just like what the subject said but the ip is different example if now my IP is 192.168.0.50 and my name is seed if i wanna terminate 192.168.0.55 with the same nick of mine, seed can i do that ?? and what is the command ?? (2 Replies)
Discussion started by: SeeD
2 Replies
Login or Register to Ask a Question
PTHREAD_EXIT(3) 					     Linux Programmer's Manual						   PTHREAD_EXIT(3)

NAME
pthread_exit - terminate calling thread SYNOPSIS
#include <pthread.h> void pthread_exit(void *retval); Compile and link with -pthread. DESCRIPTION
The pthread_exit() function terminates the calling thread and returns a value via retval that (if the thread is joinable) is available to another thread in the same process that calls pthread_join(3). Any clean-up handlers established by pthread_cleanup_push(3) that have not yet been popped, are popped (in the reverse of the order in which they were pushed) and executed. If the thread has any thread-specific data, then, after the clean-up handlers have been executed, the corresponding destructor functions are called, in an unspecified order. When a thread terminates, process-shared resources (e.g., mutexes, condition variables, semaphores, and file descriptors) are not released, and functions registered using atexit(3) are not called. After the last thread in a process terminates, the process terminates as by calling exit(3) with an exit status of zero; thus, process- shared resources are released and functions registered using atexit(3) are called. RETURN VALUE
This function does not return to the caller. ERRORS
This function always succeeds. CONFORMING TO
POSIX.1-2001. NOTES
Performing a return from the start function of any thread other than the main thread results in an implicit call to pthread_exit(), using the function's return value as the thread's exit status. To allow other threads to continue execution, the main thread should terminate by calling pthread_exit() rather than exit(3). The value pointed to by retval should not be located on the calling thread's stack, since the contents of that stack are undefined after the thread terminates. BUGS
Currently, there are limitations in the kernel implementation logic for wait(2)ing on a stopped thread group with a dead thread group leader. This can manifest in problems such as a locked terminal if a stop signal is sent to a foreground process whose thread group leader has already called pthread_exit(3). SEE ALSO
pthread_create(3), pthread_join(3), pthreads(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-03-30 PTHREAD_EXIT(3)