Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-19-2005, 09:57 AM   #1
Registered: Mar 2005
Posts: 61

Rep: Reputation: 15
How to kill a user thread in Linux.... Help me

Hi all,
I want to kill a thread spawned by main thread from main thread.
Before the complition of the spawned thread.
I want to know how can i accomplish this task.... ? If any one know plz hepl me...

With Regard
Old 04-19-2005, 10:49 AM   #2
Registered: Sep 2004
Distribution: Debian, Ubuntu, BeatrIX, OpenWRT
Posts: 273

Rep: Reputation: 30
What thread library are you using? What programming language? Maybe some example code of what you are trying to do?


Old 04-19-2005, 01:18 PM   #3
Registered: Nov 2004
Location: Spokane, WA
Distribution: Debian 6.0
Posts: 369

Rep: Reputation: 30
thread or process?
Old 04-20-2005, 03:25 AM   #4
Registered: Jan 2004
Location: Munich
Distribution: SuSE 9.2, 10.2, 10.3, knoppix
Posts: 276

Rep: Reputation: 31
If you are using POSIX threads: keep the pthread_t which is is returned by pthread_create (that is, the thread handle). To kill the thread, use pthread_kill with said pthread_t passed as argument.

Old 04-20-2005, 05:13 AM   #5
Registered: Mar 2005
Posts: 61

Original Poster
Rep: Reputation: 15
Thanks all to respond my query. Actully i m using POSIX thread in C and Linux. I got the solution by doing some thing here and there. The answer is :
To terminate a user thread prematurely use the API "pthread_cancel" from the thread which want to kill the target thread.

For the furthre details about pthread library follw the following link :

hanks all.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I kill a user session? vous Linux - Security 3 03-20-2005 02:02 PM
How to kill a user? ziphem Linux - General 11 03-12-2005 07:55 PM
Please move my thread or kill it or something. :-( gplacek Slackware 1 08-27-2004 02:25 PM
How do I kill a user? phil1076 Linux - General 16 04-11-2004 10:11 AM
who idle user how to kill saavik Linux - Networking 1 03-04-2004 11:12 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration