Initializing non-static locks

William R. Dirks (dirks@netcom.com)
Tue, 27 Oct 1998 15:02:00 -0800 (PST)


I hit this problem in my driver. The way I solved it was to make a
static variable
rwlock_t rw_lock_unlocked = RW_LOCK_UNLOCKED;

Then use rw_lock_unlocked instead of RW_LOCK_UNLOCKED. Maybe that is an
idea for the kernel?

Bill.

> The problem is that it is not an initialization but an asignment.
> Then gcc barfs and stops on error; because you can not use = to asign
> a structure...(gcc-2.7.2.3)
>
> On 27-Oct-98 Horst von Brand wrote:
> > "Manuel J. Galan" <manolow@step.es> said:
> >> - tmp->cad_lock = RW_LOCK_UNLOCKED;
> >> + memcpy (&tmp->cad_lock, &tmp_rw_lock, sizeof (tmp_rw_lock));

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/