Jump to content

  • Log In with Google      Sign In   
  • Create Account

Can we do multithreading without relying on Win32 programming?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 tom_mai78101   Members   -  Reputation: 572

Like
0Likes
Like

Posted 14 January 2012 - 12:47 PM

If I were given a choice between Java and C++ to do multiprogramming, I would always choose Java, for its simplicity in multithreading. I would not choose C++ to do multithreading, because of Win32. But, if I'm forced to use one of the languages, then I will not complain.

A little while ago, I read something about C++1x, a standard of C++. I know all of this new standard and whatnots. Then I see that there will be a <thread.h> standard template library header in the C++0x (somehow jumped to C++1x for being too slow).

If <thread.h> are to be included in C++ STL, I won't be needing Win32 to create multithreading applications. From here, it becomes a chain of memories.

I imagine myself creating non-Win32 C++ programs with multithreading, drawing non-Win32 frames (similar to Java JFrames), using STLs to create a window frame in C++, etc. Then dreams of me wishing for C++ and Java to be alike (C++ with an universal STL that is just like Java SDK).

God, help me.

Do you think we can do multithreading without doing Win32 programming in the future?

Sponsor:

#2 mightypigeon   Members   -  Reputation: 503

Like
0Likes
Like

Posted 15 January 2012 - 02:41 PM

Why are you so against Win32? It seems strange to dismiss an entire language because of that. Win32 will make up a tiny fraction of the boilerplate stuff for a game project, the majority of the game code is not dependent on anything.

Java still uses win32 under the hood. There are application toolkits and libraries for C++ like wxWidgets and Qt which allow you to do the things you want to do without having to touch Win32, but you will never see such a thing in the STL/standard library


#3 Hodgman   Moderators   -  Reputation: 30424

Like
2Likes
Like

Posted 15 January 2012 - 05:20 PM

A little while ago, I read something about C++1x, a standard of C++. I know all of this new standard and whatnots. Then I see that there will be a <thread.h> standard template library header in the C++0x (somehow jumped to C++1x for being too slow).
Do you think we can do multithreading without doing Win32 programming in the future?

Yes, as you just said, the new version of C++ includes threads in it's standard library.

At the moment though, you're not at all forced to use Win32 threads; you could be using pthreads, or boost::threads, etc...

I imagine myself creating non-Win32 C++ programs, drawing non-Win32 frames (similar to Java JFrames), using STLs to create a window frame in C++, etc. Then dreams of me wishing for C++ and Java to be alike (C++ with an universal STL that is just like Java SDK).

Features such as windows/layouts will likely never be a part of the standard C++ library.

However, as with the above threading libraries, there's plenty of C++ GUI libraries, such as Wx or Qt, etc...

#4 daviangel   Members   -  Reputation: 600

Like
0Likes
Like

Posted 15 January 2012 - 06:00 PM

Do you think we can do multithreading without doing Win32 programming in the future?

As was mentioned you can already do this with Pthreads, etc. so I don't get what you're trying to get at?
Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe

#5 dublindan   Members   -  Reputation: 457

Like
0Likes
Like

Posted 15 January 2012 - 11:43 PM

Intel Threading Building Blocks

#6 tom_mai78101   Members   -  Reputation: 572

Like
0Likes
Like

Posted 17 January 2012 - 04:35 AM

As was mentioned you can already do this with Pthreads, etc. so I don't get what you're trying to get at?


I was more keen on having a standard thread library for C++ embedded in the STL, and no having to rely on downloading additional libraries and have to do the include/lib setup in each C++ project settings.

Unlike C++, Java has them entirely bundled up upon initial startup. The only thing I like more than C++ is the ability to have all the libraries (SDK) bundled up, ready for use. What C++ lacks in the STL is some things Java had covered, like threading, networking, some multimedia stuffs, etc.

Or I may have mistaken something and obviously saw what Java had, but haven't seen what C++ had evidently. That's the only thing I have when comparing Java and C++. It's not like I choose a language over Win32 or holding onto a grudge with one of the languages.

#7 alnite   Crossbones+   -  Reputation: 2112

Like
0Likes
Like

Posted 17 January 2012 - 05:49 AM


As was mentioned you can already do this with Pthreads, etc. so I don't get what you're trying to get at?


I was more keen on having a standard thread library for C++ embedded in the STL, and no having to rely on downloading additional libraries and have to do the include/lib setup in each C++ project settings.

Unlike C++, Java has them entirely bundled up upon initial startup. The only thing I like more than C++ is the ability to have all the libraries (SDK) bundled up, ready for use. What C++ lacks in the STL is some things Java had covered, like threading, networking, some multimedia stuffs, etc.

Or I may have mistaken something and obviously saw what Java had, but haven't seen what C++ had evidently. That's the only thing I have when comparing Java and C++. It's not like I choose a language over Win32 or holding onto a grudge with one of the languages.


Your mistake is to think that Win32 is part of C and C++, and Java libraries (networking, multimedia, etc.) are part of Java. They are not.

C and C++ does not come with all the fancy libraries because a lot of them are platform specific. If you want to make an application in Windows, then you should create application in the way that Windows like it. If you create for Mac OS X, then use Mac OS X libraries. Maybe one day there's a new embedded OS which runs in an entirely different platform and hardware that the concept of GUI no longer existed, so then you had to use what the platform had to offer.

Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.

#8 Serapth   Crossbones+   -  Reputation: 5485

Like
0Likes
Like

Posted 17 January 2012 - 09:51 AM

Your mistake is to think that Win32 is part of C and C++, and Java libraries (networking, multimedia, etc.) are part of Java. They are not.

C and C++ does not come with all the fancy libraries because a lot of them are platform specific. If you want to make an application in Windows, then you should create application in the way that Windows like it. If you create for Mac OS X, then use Mac OS X libraries. Maybe one day there's a new embedded OS which runs in an entirely different platform and hardware that the concept of GUI no longer existed, so then you had to use what the platform had to offer.

Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.



This is actually no longer true, C++11 includes threading as part of the STL. As has been mentioned earlier, 3rd party cross platform threading libraries have been available for a while, basically they deal with the nitty gritty of threads so you don't have to. I think I disagree with your suggestion to go native whenever possible. Frankly if you don't make significant gains, writing separate code for different OSes is just a waste of your time and resources. Platforms such as Java or .NET, or frameworks such as Qt or wxWindows, make it so you don't have to roll your own for each platform, and generally, you should take advantage.



Also, the concept of threading is a bit muddied, as there are hardware threads, software threads, WIn32 threads, Java threads, .NET threads, etc... and these aren't all the same thing, although in some cases they are. Often times, when you peel back all the layers, you will discover the JVM or .NET runtime are calling CreateThread or a similar ilk from the Win32 subsystem ( when running on Windows that is ). Throw in mutli-processor machines and it gets even more confusing ( as a hardware thread is tied to a single core ).

#9 tom_mai78101   Members   -  Reputation: 572

Like
-1Likes
Like

Posted 17 January 2012 - 11:12 AM

I swear, once Microsoft updates their compiler to be compatible with C++1x completely, it will be in year 2020...

Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.


EXACTLY how you described my thought! But yeah... If there's a VM for all platforms to C++, then maybe I don't have to worry a thing about this at all. If only Microsoft would create .NET for all platforms available, then I'm in heavens!

#10 Chris_F   Members   -  Reputation: 2388

Like
0Likes
Like

Posted 17 January 2012 - 11:31 AM

I swear, once Microsoft updates their compiler to be compatible with C++1x completely, it will be in year 2020...


Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.


EXACTLY how you described my thought! But yeah... If there's a VM for all platforms to C++, then maybe I don't have to worry a thing about this at all. If only Microsoft would create .NET for all platforms available, then I'm in heavens!


You shouldn't compare Java to C++. As far as programming languages go, you really couldn't get more apples to oranges than that. C++ is a native compiled language. If you want a VM language, then just stick to Java.

#11 keltor2243   Members   -  Reputation: 123

Like
0Likes
Like

Posted 17 January 2012 - 11:36 AM

I would strongly suggest just getting "over" the issue with external libs and use Boost.Thread. It's great and multiplatform. In Windows-land, you'll have to wait for "maybe" VC11 for <thread> support and even then thread-local storage support is iffy.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS