LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 04-19-2005, 08:57 AM   #1
rajsun
Member
 
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
Rajesh.
 
Old 04-19-2005, 09:49 AM   #2
kees-jan
Member
 
Registered: Sep 2004
Distribution: Debian, Ubuntu, BeatrIX, OpenWRT
Posts: 273

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

Groetjes,

Kees-Jan
 
Old 04-19-2005, 12:18 PM   #3
sgrayban
Member
 
Registered: Nov 2004
Location: Spokane, WA
Distribution: Debian 6.0
Posts: 369

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

Rep: Reputation: 30
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.


HTH
 
Old 04-20-2005, 04:13 AM   #5
rajsun
Member
 
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 :
----------------------------------------------------------------------------
http://publib.boulder.ibm.com/iserie...s/users_97.htm
----------------------------------------------------------------------------

hanks all.
 
  


Reply


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 01:02 PM
How to kill a user? ziphem Linux - General 11 03-12-2005 06:55 PM
Please move my thread or kill it or something. :-( gplacek Slackware 1 08-27-2004 01:25 PM
How do I kill a user? phil1076 Linux - General 16 04-11-2004 09:11 AM
who idle user how to kill saavik Linux - Networking 1 03-04-2004 10:12 AM


All times are GMT -5. The time now is 09:45 AM.

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