Jump to content

_beginthreadex not recognized?


Josh
 Share

Recommended Posts

I found out about the CreateThread mem leak and am switching the code to use _beginthreadex instead. However, the function is not recognized in Visual Studio. I do have the code generation set to multi-threaded. Does anyone know why this would still be happening?

post-1-0-20326600-1358926945_thumb.png

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I would use pthreads, because it's cross-platform. It's built-in in mingw64, but for VisualStudio it's a seperate download: http://sourceware.org/pthreads-win32/

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

It already uses pthreads for everything but Windows. What do they do, make a wrapper around the Windows thread functions?

 

On Windows, you have three thread creation functions:

  • CreateThread
  • _beginthread
  • _beginthreadex

 

And I guess the first two produce memory leaks with C++. ohmy.png Fortunately, you can slip _beginthreadex in easily and if you designed your threads around CreateThread, it still works the same. rolleyes.gif

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...