'Returns the first unused index in the function list.'

def firstavailableindex(self):

    i = 0
    self._render_lock.acquire()
    while (i in self._functions):
        i += 1
    self._render_lock.release()
    return i
