LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 07-02-2002, 09:37 AM   #1
luftwaffe
LQ Newbie
 
Registered: Jul 2002
Posts: 19

Rep: Reputation: 0
Post How to get current thread id?


Hello,

I would like to know thread id of the process my program start in.
I have one main thread, so I do not start others.

Tried pthread_self but always returns 0

Have no clue why (coming from windows, where GetCurrentThreadId() does this job)
 
Old 07-03-2002, 08:13 AM   #2
bbeers
Member
 
Registered: Jul 2002
Location: Florida
Distribution: Centos, Slackware
Posts: 260

Rep: Reputation: 30
Does pthread_self() make sense if you didn't do a pthread_create()?
Would get_pid() work for you?

-Bob
 
Old 07-03-2002, 08:23 AM   #3
luftwaffe
LQ Newbie
 
Registered: Jul 2002
Posts: 19

Original Poster
Rep: Reputation: 0
Hello,

Finally I got it. I collect PID (getpid()) and TID (pthread_self()).
The problem was that the compiled library was missing.

Thanks for your reply.
 
  


Reply



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
[thread control suggestion] add a "solved" button that the thread starter can click atom LQ Suggestions & Feedback 3 03-24-2005 11:55 AM
Main thread sending notification to child thread rajesh_b Programming 1 09-22-2004 09:15 AM
configure qt thread issue (just compiled qt w/ -thread option) cleff Linux - Software 8 05-07-2004 11:11 PM
current Slack-Current giving troubles? r_jensen11 Slackware 5 02-02-2004 05:08 PM
Can a thread starter close the thread? ppuru LQ Suggestions & Feedback 3 07-26-2003 06:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:27 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration