Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualSollum

Posted 19 March 2013 - 03:43 PM

Hmmm, thanks for the tips!

 

For now i'll try to refrain from using threads.

 

Edit:

Do GLSurfaceView.Renderer and Activity start in different threads?

 

Because i stumbled upon that ugly problem ConcurentModificationException in a list.

 

Wrote some locks, but frankly... they look bad >.<

 

 

 

private boolean bIIA_ListLocked;

public boolean isIIALLocked()
{
   return bIIA_ListLocked;
}


public void lockIIAL()
{
   bIIA_ListLocked = true;
}


public void unlockIIAL()
{
   bIIA_ListLocked = false;
}


public void manageEvents()
{
   if (!isIIALLocked())
   {
      lockIIAL();

      for (InterfaceInputAction IIA : IIA_List)
      {
         System.out.println(IIA.getSource() + " " + IIA.getAction());
      }

      IIA_List.clear();

      unlockIIAL();
   }
}


private void addInputEvent(InterfaceInputAction IIA)
{
   if (!isIIALLocked())
   {
      lockIIAL();

      IIA_List.add(IIA);

      unlockIIAL();
   }
}
 

#1Sollum

Posted 19 March 2013 - 12:00 PM

Hmmm, thanks for the tips!

 

For now i'll try to refrain from using threads.


PARTNERS