Implicit scope handle
Radosław Smogura
mail at smogura.eu
Mon Apr 26 20:40:58 UTC 2021
Hi,
I know that I’m slightly goes in too many details.
In docs it’s “ A resource scope handle can be used to make sure that resources associated with a given resource scope
* (either explicit or implicit) cannot be released for a certain period of time”
I think this could be a bit misleading.
Now I wonder that maybe easiest solution would be to divide ResourceScope into two sub interfaces (not nessesery now).
This way the performance of implicit scope can be kept the same (maybe even better), and as well API will be more consistent?
Kind regards,
Rado
> On Apr 26, 2021, at 10:11 PM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
>
> That is all documented in the javadoc - e.g. acquiring an implicit scope is essentially a no-op. The only thing we guarantee is that if you use this idiom:
>
> ```
> var handle = scope.acquire();
> try {
> // critical region
> } finally {
> scope.release(handle);
> }
> ```
>
> the scope will not be closed inside the critical region (because of the reachability fence inside the `release` method).
>
> Maurizio
>
>> On 26/04/2021 19:44, Radosław Smogura wrote:
>>
>> Hi,
>>
>> I think this is last thing I noticed.
>>
>> The implicit scope’s handle may not work correctly and prevent garbage collection from happening.
>>
>> Right now the shared handle is returns what it’s ok for global scope.
>>
>> For separately create implicit scope, I think new handle should be created, having reference to the scope which can be cleared on close.
>>
>> Best regards,
>> Radoq
More information about the panama-dev
mailing list