23 #include <linux/jiffies.h> 27 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_M0T1FS 53 while (down_interruptible(&semaphore->
s_sem) != 0)
54 flag_was_set |= test_and_clear_thread_flag(TIF_SIGPENDING);
57 set_thread_flag(TIF_SIGPENDING);
62 return !down_trylock(&semaphore->
s_sem);
67 up(&semaphore->
s_sem);
72 return semaphore->
s_sem.count;
81 unsigned long reljiffies;
85 if (abs_timeout_realtime > nowtime)
86 reltime =
m0_time_sub(abs_timeout_realtime, nowtime);
91 reljiffies = timespec_to_jiffies(&ts);
92 return down_timeout(&semaphore->
s_sem, reljiffies) == 0;
97 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL bool m0_semaphore_trydown(struct m0_semaphore *semaphore)
M0_INTERNAL bool m0_semaphore_timeddown(struct m0_semaphore *semaphore, const m0_time_t abs_timeout)
uint64_t m0_time_nanoseconds(const m0_time_t time)
int const char const void * value
M0_INTERNAL unsigned m0_semaphore_value(struct m0_semaphore *semaphore)
m0_time_t m0_time_now(void)
M0_INTERNAL int m0_semaphore_init(struct m0_semaphore *semaphore, unsigned value)
uint64_t m0_time_seconds(const m0_time_t time)
M0_INTERNAL void m0_semaphore_fini(struct m0_semaphore *semaphore)
m0_time_t m0_time_sub(const m0_time_t t1, const m0_time_t t2)
M0_INTERNAL void m0_semaphore_down(struct m0_semaphore *semaphore)
M0_INTERNAL void m0_semaphore_up(struct m0_semaphore *semaphore)
M0_INTERNAL m0_time_t m0_time_to_realtime(m0_time_t abs_time)