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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support