Skip to content

Fix busy-wait loop in DashboardFragment #30

@kalynstricklin

Description

@kalynstricklin

This is a busy-wait with no timeout waiting for the SensorHub init and can block the UI thread or 'wait' indefinitely.

  while (service.getSensorHub() == null) {
      System.out.println("Waiting for BoundService Hub to start...");                                                                        
  }                                                                                                                                          
  while (service.getSensorHub().getEventBus() == null) {                                                                                     
      System.out.println("Waiting for BoundService Hub EventBus to start...");                                                               
  }
  • The print statements spams logcat, and there is not really anything happening if osh fails to initialize. this is bad code. Replace with callback/listener instead or something to handle this situation more gracefully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions