lkml.org 
[lkml]   [1999]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: C++ in kernel (was Re: exception in a device driver)
According to Alexander Viro:
> On Sat, 16 Jan 1999, Chip Salzenberg wrote:
> > template <semaphore_t *SEM>
> > class hold {
> > public:
> > hold() { down(SEM); }
> > ~hold() { up(SEM); }
> > };
> >
> > void random_function()
> > {
> > hold<&one_semaphore> hold1;
> > hold<&other_semaphore> hold2;
> > // ...
> > }
>
> And if you'll call something that will throw an exception here it
> will compile to?

That's target-environment-dependent. The ELF object format provides
enough structure to assist in automatic cleanups; other environments
require cleanups to be done in ways more like hand-written C.

BTW, there are many places where you
> * release the lock on different pathes.
> * don't want to hold it too long.
> * release it from another function, called by you.
> * have to release a spinlock before the blocking operation.
> * have scopes incompatible with syntax ones,

A bit of code rearrangement can be required, yes. TANSTAAFL.
--
Chip Salzenberg - a.k.a. - <chip@perlsupport.com>
"When do you work?" "Whenever I'm not busy."

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:1.010 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site