Esempio n. 1
0
 public void GetZeroInitializedWaitSet()
 {
     // NOTE: The struct rcl_wait_set_t contains size_t
     // fields that are set to UIntPtr in C# declaration,
     // not guaranteed to work for all C implemenations/platforms.
     rcl_wait_set_t waitSet = NativeMethods.rcl_get_zero_initialized_wait_set();
 }
Esempio n. 2
0
        public void WaitSetInit()
        {
            rcl_wait_set_t  waitSet   = NativeMethods.rcl_get_zero_initialized_wait_set();
            rcl_allocator_t allocator = NativeMethods.rcl_get_default_allocator();

            TestUtils.AssertRetOk(NativeMethods.rcl_wait_set_init(ref waitSet, 1, 0, 0, 0, 0, allocator));
            TestUtils.AssertRetOk(NativeMethods.rcl_wait_set_fini(ref waitSet));
        }
Esempio n. 3
0
        public void WaitSetAddSubscription()
        {
            NativeMethods.rcl_reset_error();

            rcl_wait_set_t waitSet = NativeMethods.rcl_get_zero_initialized_wait_set();

            TestUtils.AssertRetOk(NativeMethods.rcl_wait_set_init(ref waitSet, 1, 0, 0, 0, 0, allocator));
            TestUtils.AssertRetOk(NativeMethods.rcl_wait_set_clear(ref waitSet));

            Assert.That(NativeMethods.rcl_subscription_is_valid(ref subscription), Is.True);
            TestUtils.AssertRetOk(NativeMethods.rcl_wait_set_add_subscription(ref waitSet, ref subscription, UIntPtr.Zero));

            RCLReturnEnum ret = (RCLReturnEnum)NativeMethods.rcl_wait(ref waitSet, Utils.TimeoutSecToNsec(0.01));

            Assert.That(ret, Is.EqualTo(RCLReturnEnum.RCL_RET_TIMEOUT));
        }