def Init():
  global defaultProcess
  defaultProcess = thread.get_ident()
  c = static._get('c')
  c.TablesRef = {}
  c.intervalPool = [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None] # A maximum of 25 IntervalInContext's
  c.intervalPoolMax = 25
  c.intervalPoolIndex = -1
def GetPairForProcess(table, c):
  # returns (pp: ProcessPair):
  global noteThreads
  if noteThreads:
    process = thread.get_ident()
    for pair in table.processes: # pair is a ProcessPair
      if pair.process == process: return pair
    pp = AddProcessPair(table, process, c)
  else:
    if table.processes == None or (len(table.processes) == 0):
      pp = AddProcessPair(table, defaultProcess, c)
    else: pp = table.processes[0]
  return pp