Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7086061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:30:10+00:00 2026-05-28T07:30:10+00:00

I am coding for a pthread C++ program. I got error: pthread_getunique_np was not

  • 0

I am coding for a pthread C++ program.

I got error:
“pthread_getunique_np” was not declared in this scope

The pthread_getunique_np or others with “*np” are not portable.

I cannot find solutions from posts online .

I know _np means it is not a POSIX standard.

How to get around this ? I need to include some header files or other substitutes ?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:30:10+00:00Added an answer on May 28, 2026 at 7:30 am

    Like Martin said, on many systems, you can just used the pthread_t of the thread as a unique identifier. You can retrieve this with pthread_self(3), which is POSIX. You can use the function pthread_equal(3) to test two pthread_ts for equivalence.

    pthread_t threadID = pthread_self();
    if (pthread_equal(threadID, someOtherID) != 0)
        /* Branch based on being the same thread */
    else
        /* Branch based on being different threads */
    

    As far as I can tell, pthread_getunique_np() returns a unique integer ID, which is different than using a pthread_t as an identifier. On many systems, the values returned from both pthread_self(3) andf pthread_getunique_np() are the same. In fact, you need the pthread_t to obtain the unique integer.

    Either way, pthread_self(3) is required to return the ID of the thread from which it is called, so I believe you should be able to use this portable function the way you want.

    (Information about pthread_getunique_np() from IBM)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This coding i got from here. I get error in log cat view like
(Coding PHP with MySQL) Fatal error: Cannot redeclare logged_in() (previously declared in C:\xampp\htdocs\Project\Func\user.func.php:9) in
Coding in VB.Net Hi guys I've got this problem where I'm trying to assign
Coding footer naively, if there's not enough content, then there will be empty space
During coding I frequently encounter this situation: I have several objects ( ConcreteType1 ,
I´m coding a CSS menu for Wordpress and I have this stupid problem: I
When coding in C# I like not to handle exceptions because it makes it
Do coding this way pose any security risks? $test = $_GET['test']; if($test) { $sql
This is the main code of my server program in C: int main(int argc,
***Coding in C# This works: NpgsqlConnection conn = new NpgsqlConnection(conx.getConexion()); conn.Open(); NpgsqlDataAdapter da =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.