Beispiel #1
0
 def write_func(ident):
     with lock.write_lock():
         enter_time = _utils.now()
         time.sleep(WORK_TIMES[ident % len(WORK_TIMES)])
         exit_time = _utils.now()
         start_stops.append((lock.WRITER, enter_time, exit_time))
         time.sleep(NAPPY_TIME)
Beispiel #2
0
 def write_func(ident):
     with lock.write_lock():
         enter_time = _utils.now()
         time.sleep(WORK_TIMES[ident % len(WORK_TIMES)])
         exit_time = _utils.now()
         start_stops.append((lock.WRITER, enter_time, exit_time))
         time.sleep(NAPPY_TIME)
Beispiel #3
0
 def read_func(ident):
     with lock.read_lock():
         # TODO(harlowja): sometime in the future use a monotonic clock here
         # to avoid problems that can be caused by ntpd resyncing the clock
         # while we are actively running.
         enter_time = _utils.now()
         time.sleep(WORK_TIMES[ident % len(WORK_TIMES)])
         exit_time = _utils.now()
         start_stops.append((lock.READER, enter_time, exit_time))
         time.sleep(NAPPY_TIME)
Beispiel #4
0
 def read_func(ident):
     with lock.read_lock():
         # TODO(harlowja): sometime in the future use a monotonic clock here
         # to avoid problems that can be caused by ntpd resyncing the clock
         # while we are actively running.
         enter_time = _utils.now()
         time.sleep(WORK_TIMES[ident % len(WORK_TIMES)])
         exit_time = _utils.now()
         start_stops.append((lock.READER, enter_time, exit_time))
         time.sleep(NAPPY_TIME)