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 6813277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:33:04+00:00 2026-05-26T20:33:04+00:00

There are a couple of things that I don’t understand about the function pthread_create

  • 0

There are a couple of things that I don’t understand about the function pthread_create.

here is the header

int pthread_create(pthread_t *restrict thread,
                   const pthread_attr_t *restrict attr,
                   void *(*start_routine)(void*), 
                   void *restrict arg);

Firstly, I’m not familiar with the syntax of void *(*start_routine)(void*),. I know that the argument asked for here is the name of a function that returns void *, and takes one void * as its argument. Presumably pthread_create will refer to that funcion as start_routine. So I suppose this argument would be a function pointer? If so, what are the key syntax elements that make it so?

Secondly, why does pthread_create expect a function that has void * as its return type? What would pthread_create be able to do with data of unkown type?

  • 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-26T20:33:05+00:00Added an answer on May 26, 2026 at 8:33 pm

    The void *(*start_routine)(void*) should be read in the following order:

    • start_routine – Name of the argument.
    • *start_routine – So this argument is a pointer.
    • (*start_routine)(...) – Aha, it’s a pointer to a function.
    • (*start_routine)(void*) – We now know the argument(s) of the function.
    • void *(*start_routine)(void*) – And finally, this tells us the return type of the function.

    The void* argument receives whatever is passed to arg – so if you need to pass any “input” to your new thread this is one way to do it.

    The resulting void* is used as thread’s exit status (as alternative to calling pthread_exit() explicitly). You can get this status through pthread_join().

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

Sidebar

Related Questions

I'm reading about Azure and there are a couple of things I don't understand:
I've read a couple of things about MVCs but I still don't understand when
There are a couple of different .NET XSLT functions that I see used in
During startup of my WinForms application I'm noting that there are a couple of
Background: There are a couple of concerns that are not core business for us.
I know that there are a lot of discussions already on SO about SOAP,
There are a couple of tricks for getting glass support for .Net forms. I
There are a couple of questions similar to this on stack overflow but not
There are a couple of open source apps I am trying to recompile to
There are a couple of questions on Stackoverflow asking whether x ( Ruby /

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.