On Sun, Jul 27, 2008 at 5:12 PM, Bert Miemietz <[EMAIL PROTECTED]> wrote:
> Came upon a strange thing with ddi_get_lbolt and cv_timedwait.
> Following a code fragment to show the issue:
>
> mutex_enter(&ptr->mutex);
> while (ptr->busy != 0) {
>  clock_t until;
>  (void) ddi_get_lbolt(); /* just call function, seems not to work at first 
> call */
>  until = ddi_get_lbolt() + drv_usectohz(tmo);
>  if (cv_timedwait(&ptr->cv, &ptr->mutex, until) == -1) {
>     mutex_exit(&ptr->mutex);
>     err = EAGAIN;
>     goto somewhere_else;
>  }
> }
> mutex_exit(&mstr_ptr->vv_mutex);
>
> In theory the line "(void) ddi_get_lbolt();" should be completely unnecessary.
> But in case I omit this line and ddi_get_lbolt() has never been called before
> in the driver cv_timedwait() will not return when timeout is reached without
> the condition being signaled. Inserting that (in theory useless) line makes
> everything work fine.
>
> Did I understand or do something wrong or is it really a bug?
> I'm a little bit unsure if I have seen this on all platforms. Last time I was 
> getting
> into this trap was on Solaris x86 / single cpu machine.
>
>

Why is the lock different between mutex_enter and mutex_exit?
tmo = ?

Thanks,
-Aubrey
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to