In message <[EMAIL PROTECTED]>,"Srikanth Vishw
>while (seq == evp->seq) {
> AFS_ASSERT_GLOCK();
> AFS_GUNLOCK();
> interruptible_sleep_on(&evp->cond);
> AFS_GLOCK();
>...
>Is there a better way to do this ? May be a Linux API ? Something
>like Solaris's cv_wait(kcondvar_t *, kmutex_t *) would be nice.
this is a somewhat fairly well known problem with using interruptible_sleep_on
see pg 286 of linux device drivers second edition. you need to put the
event on the wait queue before you do anything that trigger the corresponding
wake_up. i think this would be more correct than the unlock_/lock_kernel idea.
something like (and this probably isnt quite right, but close i hope):
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
/* blah blah blah */
add_wait_queue(&evp->cond, &wait);
set_current_state(TASK_INTERRUPTIBLE);
while (seq == evp->seq) {
AFS_ASSERT_GLOCK();
AFS_GUNLOCK();
schedule();
AFS_GLOCK();
/* blah blah blah */
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&evp->cond, &wait);
_______________________________________________
OpenAFS-devel mailing list
[EMAIL PROTECTED]
https://lists.openafs.org/mailman/listinfo/openafs-devel