Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

Flopid

Member Since 13 Jun 2005
Offline Last Active Yesterday, 09:31 AM
-----

Topics I've Started

Java Deadlock Question

17 June 2013 - 12:28 PM

Hello. I've got back into programing with OpenGL (JOGL) since it's so portable. I wanted to make my engine multithreaded so I've read up a Java trail about concurency and stumbled on something interesting here:

 

http://docs.oracle.com/javase/tutorial/essential/concurrency/deadlock.html

 

How can both threads enter bow if it is synchronized, so that as the article says, they will both be stuck at bowback? Is it possible for threads to enter synchronized methods at the exact same time, but not right after eachother then or wha?

 

This would completely mess up the whole sync identifier, since threads can pretty much always call the method at the same time...

 

Really weird, watcha think?


Program Wide Global Vars in C++?

28 December 2012 - 08:48 PM

I've just recently learned from my program that "static" or pointer variables do not neccesseraly mean global program wide. I have a single .h file included for main .cpp and another .cpp file. When I changed the variable in main and read it in the other class it was not the same value as I've set it in the main class, even though it was declared static, or as I've tested even if it is a pointer, in the .h file.

 

Seems like the only way in C++ to have access to a variable you would like to use in another class is to pass it through a function or a constructor as well as using inheritance. As I recall in Java or C# a static variable or a function can be defined in one class and changed from a class while changing it for all the other classes.

 

It may be breaking the laws of OOP but I was just wondering if it was possible in C++.

 

Thank you, and have a nice day!!! smile.png


PARTNERS