View mode: basic / threaded / horizontal-split · Log in · Help
August 01, 2003
new control structure
Here is just an idea.

Consider the following code :

lock.acquire();
doSomthing();
lock.release();


acquire & release are tightly related : when you call one, you *must* call
the other. There is many other exemple of that : acquiring a connection from
a connection pool, thread from a thread pool, notify to the system that you
start painting an area then notify that it's over, transactions ...

What about something like that :

interface Acquirable {
   void acquire();
   void release();
}

and this controle structure :

acquire( Acquirable ) {


   // here Aquirable is released.
}



acquire( lock ) {
   doSomething();
}


Well ... i dont know if it's realy usefull.

-- Nicolas Repiquet
August 02, 2003
Re: new control structure
somewhere back in the archive there is something from me about this
using a templated auto class
I wanted

instance foo(T).obj OBJ;
with( auto new OBJ(p) ) {
}

rather than
{
   auto OBJ obj(p);
}

allowing any type of acquire/lock via a simple template.

"DeadCow" <deadcow-remove-this@free.fr> wrote in message
news:bgesvf$1fq8$1@digitaldaemon.com...
> Here is just an idea.
>
> Consider the following code :
>
> lock.acquire();
> doSomthing();
> lock.release();
>
>
> acquire & release are tightly related : when you call one, you *must* call
> the other. There is many other exemple of that : acquiring a connection
from
> a connection pool, thread from a thread pool, notify to the system that
you
> start painting an area then notify that it's over, transactions ...
>
> What about something like that :
>
> interface Acquirable {
>     void acquire();
>     void release();
> }
>
> and this controle structure :
>
> acquire( Acquirable ) {
>
>
>     // here Aquirable is released.
> }
>
>
>
> acquire( lock ) {
>     doSomething();
> }
>
>
> Well ... i dont know if it's realy usefull.
>
> -- Nicolas Repiquet
>
>
>
Top | Discussion index | About this forum | D home