[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [bluetooth-dev] SDP problem...




> >       cli();
> >       if (database_query.count <= 0) {
> >               D_PROC(__FUNCTION__ " No bytes available, going to sleep\n");
> >               interruptible_sleep_on(&database_wq);
> >       }
> >       sti();
>  
> > So when sdp_server tries to read the sdp_proc file, all 
> > interrupts are disabled, and then it goes to sleep right?
> > So, no more interrupts can happen. I don't understand
> > this piece of code (I'm sorry).
>
>interruptible_sleep_on() enables interrupts while it is waiting, and disables them again before returning.
Nop, it doesn't. 

#define SLEEP_ON_HEAD                                   \
         wq_write_lock_irqsave(&q->lock,flags);          \
         __add_wait_queue(q, &wait);                     \
         wq_write_unlock(&q->lock);

#define SLEEP_ON_TAIL                                           \
         wq_write_lock_irq(&q->lock);                            \
         __remove_wait_queue(q, &wait);                          \
         wq_write_unlock_irqrestore(&q->lock,flags);

void interruptible_sleep_on(wait_queue_head_t *q)
{
         SLEEP_ON_VAR

         current->state = TASK_INTERRUPTIBLE;

         SLEEP_ON_HEAD
         schedule();
         SLEEP_ON_TAIL
}

Name interruptible has nothing to do with hardware interrupts.  It just mean that sleep can 
be interrupted by the signal.

Max

Maksim Krasnyanskiy	
Senior Kernel Engineer
Qualcomm Incorporated

maxk@xxxxxxx.com
http://bluez.sf.net
http://vtun.sf.net

-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com