+/**
+ * canque_get_inslot4id_wait_rtl - find or wait for best outgoing edge and slot for given ID
+ * @qends: ends structure belonging to calling communication object
+ * @qedgep: place to store pointer to found edge
+ * @slotp: place to store pointer to allocated slot
+ * @cmd: command type for slot
+ * @id: communication ID of message to send into edge
+ * @prio: optional priority of message
+ *
+ * Same as canque_get_inslot4id(), except, that it waits for free slot
+ * in case, that queue is full. Function is specific for Linux userspace clients.
+ * Return Value: If there is no usable edge negative value is returned.
+ */
+int canque_get_inslot4id_wait_rtl(struct canque_ends_t *qends,
+ struct canque_edge_t **qedgep, struct canque_slot_t **slotp,
+ int cmd, unsigned long id, int prio)
+{
+ rtl_irqstate_t flags;
+ int ret;
+ unsigned old_age;
+ rtl_sigset_t sigset;
+
+ old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_writeq_age);
+ while((ret=canque_get_inslot4id(qends,qedgep,slotp,cmd,id,prio))==-1){
+ rtl_sigemptyset(&sigset);
+ rtl_spin_lock_irqsave(&qends->endinfo.rtlinfo.rtl_lock, flags);
+ if(old_age == atomic_read(&qends->endinfo.rtlinfo.rtl_writeq_age))
+ sigset=rtl_wait_sleep(&qends->endinfo.rtlinfo.rtl_writeq, &qends->endinfo.rtlinfo.rtl_lock);
+ rtl_spin_unlock_irqrestore(&qends->endinfo.rtlinfo.rtl_lock, flags);
+ if(RTL_SIGINTR(&sigset))
+ return -1;
+ old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_writeq_age);
+ }
+
+ return ret;
+}
+
+
+/**
+ * canque_get_outslot_wait_rtl - receive or wait for ready slot for given ends
+ * @qends: ends structure belonging to calling communication object
+ * @qedgep: place to store pointer to found edge
+ * @slotp: place to store pointer to received slot
+ *
+ * The same as canque_test_outslot(), except it waits in the case, that there is
+ * no ready slot for given ends. Function is specific for Linux userspace clients.
+ * Return Value: Negative value informs, that there is no ready output
+ * slot for given ends. Positive value is equal to the command
+ * slot has been allocated by the input side.
+ */
+int canque_get_outslot_wait_rtl(struct canque_ends_t *qends,
+ struct canque_edge_t **qedgep, struct canque_slot_t **slotp)
+{
+ rtl_irqstate_t flags;
+ int ret;
+ unsigned old_age;
+ rtl_sigset_t sigset;
+
+ old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_readq_age);
+ while((ret=canque_test_outslot(qends,qedgep,slotp))==-1){
+ rtl_sigemptyset(&sigset);
+ rtl_spin_lock_irqsave(&qends->endinfo.rtlinfo.rtl_lock, flags);
+ if(old_age == atomic_read(&qends->endinfo.rtlinfo.rtl_readq_age))
+ sigset=rtl_wait_sleep(&qends->endinfo.rtlinfo.rtl_readq, &qends->endinfo.rtlinfo.rtl_lock);
+ rtl_spin_unlock_irqrestore(&qends->endinfo.rtlinfo.rtl_lock, flags);
+ if(RTL_SIGINTR(&sigset))
+ return -1;
+ old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_readq_age);
+ }
+ return ret;
+}
+
+
+/**
+ * canque_sync_wait_rtl - wait for all slots processing
+ * @qends: ends structure belonging to calling communication object
+ * @qedge: pointer to edge
+ *
+ * Functions waits for ends transition into empty state.
+ * Return Value: Positive value indicates, that edge empty state has been reached.
+ * Negative or zero value informs about interrupted wait or other problem.
+ */
+int canque_sync_wait_rtl(struct canque_ends_t *qends, struct canque_edge_t *qedge)
+{
+ rtl_irqstate_t flags;
+ int ret;
+ unsigned old_age;
+ rtl_sigset_t sigset;
+
+ old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_emptyq_age);
+ while(!(ret=canque_fifo_test_fl(&qedge->fifo,EMPTY)?1:0)){
+ rtl_sigemptyset(&sigset);
+ rtl_spin_lock_irqsave(&qends->endinfo.rtlinfo.rtl_lock, flags);
+ if(old_age == atomic_read(&qends->endinfo.rtlinfo.rtl_emptyq_age))
+ sigset=rtl_wait_sleep(&qends->endinfo.rtlinfo.rtl_emptyq, &qends->endinfo.rtlinfo.rtl_lock);
+ rtl_spin_unlock_irqrestore(&qends->endinfo.rtlinfo.rtl_lock, flags);
+ if(RTL_SIGINTR(&sigset))
+ return -1;
+ old_age=atomic_read(&qends->endinfo.rtlinfo.rtl_emptyq_age);
+ }
+
+ return ret;
+}
+
+