Re: C++ in the kernel



* Jan Grant <jan.grant@xxxxxxxxxxxxx> [071031 09:57] wrote:
On Wed, 31 Oct 2007, Bakul Shah wrote:

For example what if you can't gain the lock and want
to do something else? Two, while C++ gives you a way to
solve this problem, it does it in a "clever" way, not an
obvious way.

RAII is a very common C++ idiom; that kind of thing'd be obvious to
anyone who's mired^Wimmersed in C++ on a regular basis.

That's the point here - if this was the language technology already in
use, then it'd be obvious, and nobody would think much about it. It's
not, so it looks alien, much like any other alternatives that'll get
raised along the line of C-plus-stuff look alien. Amongst C++ users with
taste (and I claim that they do exist) the natural question that'll then
be asked is, since you can already express this idea in C++ why would
you adopt a less widespread (or novel) language?

jan

PS. Paint it green.

Hhehehehe....


{
mutex_locker_trylock trylock(&mutex);

if (trylock.success()) {

} else {

}

}
// regardless if it succeeded, lock is now dropped.

I think this might even work:

{
if (mutex_locker_trylock trylock(&mutex).success()) {

} else {

}

}


brb, gonna throw up. :)

--
- Alfred Perlstein
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"