Search code examples
c++multithreadingpthreadsbeginthread

Interview: what is the difference between pthread and windows thread created by _beginthread(ex)?


I was asked about this in an c++ developer position interview, what is the answer to this?


Solution

  • I would have said:

    If I wanted to create a portable cross-platform C++ binary, I'd use pthreads and use the pthread implementation for windows. If I wanted to create a windows-specific C++ binary, I'd use beginthread and avoid the 3rd party dependency on the pthread library.

    If they really wanted to know the intricate internal details describing the differences between the two, you should think twice about working there. Unless it was for a reverse engineering job.