Example #1
0
    def test_migrate_to_thread_pool(self):
        tb = gras.TopBlock()
        vec_source = TestUtils.VectorSource(numpy.uint32, [0, 9, 8, 7, 6])
        vec_sink = TestUtils.VectorSink(numpy.uint32)

        c = gras.ThreadPoolConfig()
        tp = gras.ThreadPool(c)

        vec_source.global_config().thread_pool = tp
        vec_source.commit_config()
        tb.connect(vec_source, vec_sink)
        tb.run()

        self.assertEqual(vec_sink.data(), (0, 9, 8, 7, 6))
Example #2
0
def enable_realtime_scheduling():
    """
    This call is for backward compat purposes.
    See gras/thread_pool.hpp for greater options.
    """

    #any prio greater than 0 means realtime scheduling
    prio_value = 0.5

    #test that prio
    if not gras.ThreadPool.test_thread_priority(prio_value):
        return RT_NO_PRIVS

    #create a new thread pool with thread priority set
    config = gras.ThreadPoolConfig()
    config.thread_priority = prio_value
    tp = gras.ThreadPool(config)
    tp.set_active()

    return RT_OK
Example #3
0
 def test_make_config(self):
     c = gras.ThreadPoolConfig()
     print c.thread_count
     print c.yield_strategy
Example #4
0
 def test_make_tp_set_active(self):
     c = gras.ThreadPoolConfig()
     tp = gras.ThreadPool(c)
     tp.set_active()
Example #5
0
 def test_make_tp(self):
     c = gras.ThreadPoolConfig()
     tp = gras.ThreadPool(c)