Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static GlobalData g;
- void thread1()
- {
- while(true) {
- if (g.ptr)
- g.ptr->method();
- }
- }
- void thread2()
- {
- g.ptr = new Game();
- g.ptr->run();
- delete g.ptr;
- }
- void main()
- {
- start_thread1();
- start_thread2();
- do_something_else();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement