Tour Preview

Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › Help with threading

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #21790

    jrrobles79

    Hello, can you help me with a good tutorial on threads on felgo and qml?, I have been looking for one to help solve some problems with the Timers, but I beggining to think that the timers are not the answer.  

     

    I need to check on an api that is only available on certain period of time, I created two Timers, the first one sync with the server time, to determine the period of time the api will be open, and the second timer check the server timestamp (on the timer) to trigger the call on the api. The problem is that in some points the timers got blocked , slowed and freeze by something, and I dont know why:

     

    on dataModel:

     

    apiNextEvent:   api.getNextEvent( function(data){

    serverTimer.serverTimeStamp =    data.current_server_time

    eventTimer.nextEvent = data.next_event_timestamp

    eventTimer.nextEventClose = data.next_event_close_timestamp

    serverTimer.start()

    }, function(error){ … })

     

    on serverTimer:

     

    Timer{

    id: serverTimer

    property date serverTimeStamp: “2000-01-01 00:00:00”

    onTriggered: {

           serverTimeStamp = new Date( serverTimeStamp.getTime()+1000) 

    }

    }

     

    Timer{

    id: eventTimer

    property date nextEvent: “2000-01-01 00:00:00”

    property date nextEventClose: “2000-01-01 00:00:00”

    onTriggered:{

          if(  dateBetween( .serverTimer.serverTimeStamp,  nextEvent, nextEventClose  ) ){

            logic.getEventInfo()

    } 

    }

    }

     

     

    NOTE:  I can’t create a timer that keep checking on the   logic.getEventInfo() It will throwing only errors for most of the time

     

     

     

Viewing 1 post (of 1 total)

RSS feed for this thread

You must be logged in to reply to this topic.