CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    CreateThread API

    Hello guys, I should say it is an honour to meet you.

    Dumb question...

    Does the CreateThread still have what it takes ¿

    What I mean is, I'm a VB / VB.NET guy, and instead of using the built in Threading classes, i have always preferred doing threading with APIs.

    What are the pros and cons ( specific to VS 2010 ) in this regard ¿

    Thanx

    Hannes

  2. #2
    Join Date
    Apr 2010
    Posts
    27

    Re: CreateThread API

    Hannes, I believe CreateThread() is just not guaranteed to work in VB. Isn't it? Your programming system provides an API for thread creation, so use it. For example, in Visual C++ CreateThread() is not quite work (the run-time is dirtily patched to make it work in general, but memory leaks are still possible). Instead, Visual C++ run-time provides special __beginthreadex() function for thread creation, which is a C++ function rather than WinAPI function.

  3. #3
    Join Date
    Apr 2010
    Posts
    15

    Re: CreateThread API

    HanneS - What dvyukov said.

    I don't know about VB, but if you're using the C Runtime Library (CRT), _beginthreadex does a better job at initializations when starting threads. If you skip those by using _beginthread or CreateThread, there can be problems in other CRT function execution.

    For managed code Joe Duffy (Concurrent Programming on Windows) recommends the System.Threading.Thread class and Start methods.
    Clay Breshears
    Intel Innovative Software Education

    "There are no evil threads; just threads programmed for evil."

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: CreateThread API

    Thanx for your valuable input guys!
    Much appreciated

    I guess I've been using VB 6 for too long, before going to .NET! LOL!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured