I am new to thread programming in python. I am trying to read message from azure service bus, the message may or may not be present in the queue. So this is the logic I come up with bus_service = ServiceBusService(service_namespace='eventservice',shared_access_key_name='key-name',shared_access_key_value='password')logger.info(Created bus_service object)def service_bus_listner(callback):    thread worker function    global currentBackOff    logger.info('Started listening to service bus messages')    current_thread = threading.currentThread()    while True:        msg = bus_service.receive_subscription_message('python-test', 'AllMessages', peek_lock=True)        if msg.body is not None:            currentBackOff = 0            process_message(msg)        else:            if currentBackOff < maxBackOff:                currentBackOff += 10            logger.info(No message to process. Backing off for {0} seconds.format(currentBackOff))            time.sleep(currentBackOff)def process_message(msg):    try:        message = json.loads(msg.body.decode())        message_id = message.get('Id')        logger.info(Received message with id: %s % message_id)    except Exception as e:        logger.exception(e)    finally:        msg.delete()if __name__ == '__main__':    thread = threading.Thread(target=service_bus_listner, args=(process_message, ))    thread.start()So if the message queue is empty service_bus_listner waits for some specified seconds (controlled by currentBackOff variable) and retry till it receives a message and the value of currentBackOff variable is set to 0. The function service_bus_listner is running in a separate thread. I have gone through the documentation of time.sleep function here Time.sleep Document and it says that calling of this function Suspend execution of the current thread for the given number of seconds. Does calling time.sleep in service_bus_listner functions free up the CPU for the specified time (in seconds).I want to know the most ideal way(in terms of Memory and CPU utilization) of pausing and resuming a thread in python. 
Suspending and resuming threads for Azure bus service
python;python 3.x;multithreading