void RWLockImplLxrt38::unlock() { #ifdef STRICT_LXRT_CHECKS if (!icl_core::os::isThisLxrtTask()) { PRINTF("RWLockImplLxrt38::unlock: Called from a Linux task!\n"); return; } #endif rt_rwl_unlock(m_rwlock); }
static void fun(long idx) { unsigned int loops = LOOPS; while(loops--) { rt_printk("TASK %d 1 COND/TIMED PREWLOCKED\n", idx); if (idx%2) { if (rt_rwl_wrlock_if(&rwl)) { rt_printk("TASK %d 1 COND PREWLOCKED FAILED GO UNCOND\n", idx); rt_rwl_wrlock(&rwl); } } else if (rt_rwl_wrlock_timed(&rwl, nano2count(20000)) >= SEM_TIMOUT) { rt_printk("TASK %d 1 TIMED PREWLOCKED FAILED GO UNCOND\n", idx); rt_rwl_wrlock(&rwl); } rt_printk("TASK %d 1 WLOCKED\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 2 COND PREWLOCK\n", idx); if (rt_rwl_wrlock_if(&rwl)) { rt_printk("TASK %d 2 COND PREWLOCK FAILED GO UNCOND\n", idx); rt_rwl_wrlock(&rwl); } rt_printk("TASK %d 2 WLOCK\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 3 PREWLOCK\n", idx); rt_rwl_wrlock(&rwl); rt_printk("TASK %d 3 WLOCK\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 3 PREWUNLOCK\n", idx); rt_rwl_unlock(&rwl); rt_printk("TASK %d 3 WUNLOCK\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 2 PREWUNLOCK\n", idx); rt_rwl_unlock(&rwl); rt_printk("TASK %d 2 WUNLOCK\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 1 PREWUNLOCKED\n", idx); rt_rwl_unlock(&rwl); rt_printk("TASK %d 1 WUNLOCKED\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 1 COND/TIMED PRERDLOCKED\n", idx); if (idx%2) { if (rt_rwl_rdlock_if(&rwl)) { rt_printk("TASK %d 1 COND PRERDLOCKED FAILED GO UNCOND\n", idx); rt_rwl_rdlock(&rwl); } } else if (rt_rwl_rdlock_timed(&rwl, nano2count(20000)) >= SEM_TIMOUT) { rt_printk("TASK %d 1 TIMED PRERDLOCKED FAILED GO UNCOND\n", idx); rt_rwl_rdlock(&rwl); } rt_printk("TASK %d 1 RDLOCKED\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 2 COND PRERDLOCK\n", idx); if (rt_rwl_rdlock_if(&rwl)) { rt_printk("TASK %d 2 COND PRERDLOCK FAILED GO UNCOND\n", idx); rt_rwl_rdlock(&rwl); } rt_printk("TASK %d 2 RDLOCK\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 3 PRERDLOCK\n", idx); rt_rwl_rdlock(&rwl); rt_printk("TASK %d 3 RDLOCK\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 3 PRERDUNLOCK\n", idx); rt_rwl_unlock(&rwl); rt_printk("TASK %d 3 RDUNLOCK\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 2 PRERDUNLOCK\n", idx); rt_rwl_unlock(&rwl); rt_printk("TASK %d 2 RDUNLOCK\n", idx); rt_busy_sleep(100000); rt_printk("TASK %d 1 PRERDUNLOCK\n", idx); rt_rwl_unlock(&rwl); rt_printk("TASK %d 1 RDUNLOCK\n", idx); rt_busy_sleep(100000); } extcnt[idx - 1] = loops; rt_sleep(nano2count(10000000)); rt_printk("TASK %d EXITED\n", idx); }