Python Forum
Synchronization/Timing Problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Synchronization/Timing Problem
#5
(Mar-31-2021, 08:23 PM)deanhystad Wrote: You flip back and forth from looking at the front and the rear of the queue. That is why lastt appears to go backwards. The first time you print was after doing appending things to the queue:
        if self.phys==0 or len(self.physqueue)<=self.phys:
            self.physqueue.append([tq, q]) 
        self.lastt=tq
This sets lastt to the most recent time. However, if the if statement evaluates to False, the lasttt was updated by this code in __next__
            td, cdata = self.dataqueue.pop(0)
            self.updateqmem(td)
            self.lastt=td
This updates lasttt to the oldest item in dataqueue.

Your code is really hard to understand. Using better variable names would go a long way to improving readability; lasttt, tM, clinkdt, tq, qb? These would be ok if there was a description anywhere that says what they represent, as is I am left guessing. At the very minimum you should describe each of the arguments passed to inportProp.__init__ along with a short description of what inportProp is/does.

There is an algorithmic problem that I am always walking around...
I gave an explanation in the code for definitions
Reply


Messages In This Thread
Synchronization/Timing Problem - by quest - Mar-30-2021, 07:23 PM
RE: time is decreasing instead of incresing - by quest - Mar-31-2021, 08:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Timing actions with Python dangermaus33 0 1,041 Apr-19-2022, 10:08 PM
Last Post: dangermaus33
  Inconsistent counting / timing with threading rantwhy 1 1,807 Nov-24-2021, 04:04 AM
Last Post: deanhystad
  Timing of a while loop stylingpat 4 6,980 Mar-31-2021, 10:48 AM
Last Post: stylingpat
  Assigning Data from one column to another with different associated timing interval alexafshari 1 1,990 Apr-30-2020, 03:59 PM
Last Post: pyzyx3qwerty
  Frequency and timing of psycopg2 commits acecase 0 2,247 Nov-01-2019, 05:50 PM
Last Post: acecase
  Perpetual timing Mark17 3 2,963 Oct-24-2019, 03:46 PM
Last Post: Gribouillis
  Timing input Mark17 2 2,335 Oct-23-2019, 08:25 PM
Last Post: Mark17
  Timing functions with multiprocessing mntfr 3 5,109 Nov-18-2018, 06:00 AM
Last Post: woooee
  GPIO output timing help needed skid 5 4,132 Jan-23-2018, 04:12 PM
Last Post: skid
  change timing on py script kwfreverie 2 3,172 Dec-16-2017, 07:35 PM
Last Post: kwfreverie

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020