Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - sync between GL Thread and key/mouse/sensor events

sync between GL Thread and key/mouse/sensor events

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

sync between GL Thread and key/mouse/sensor events

Postby zorro » Mon Aug 10, 2009 3:21 pm

Hello all.
I am developing a game on android and i (obviously) need to make variables changes/calculations in the GL thread when events are coming from the main thread. I tried to implement sensor detection and it was ok, but when i tried to print the xyz values on the emulator screen, the program crashes. If i don't print them, it's ok. If i try to use the values in other ways it crashes too. So the only way to avoid the crash is not to use the sensor values at all. I think that it's because when i use the values in one thread (gl thread), in the same moments the main thread wants to update them so it's a conflict.
What should i do in order to avoid this conflict? I tried to use semaphors, but it didn't solve the problem? Maybe i used them in the wrong way.. Can someone post a solution to this problem (shared variables) and tell me how to use the actual data of the sensor?

edit: I tryed to use synchronized methods, but the problem still remains. I am wondering if Android implements the synchronized methods or it's a broken feature?

edit 2: I tried to use queueEvent(new Runnable()) like the documentation suggests and i still get the crash as soon as i use the shared variable... it's just crazy

edit 3: Sorry, it was my fault, actually i was using a non allocated reference in that function.. so it was not the synchronization's fault
User avatar
zorro
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Mon Aug 10, 2009 3:11 pm
Location: Romania

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 6 guests