Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)