harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Pervov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4238) [drlvm][kernel] Race conditions in statics initialization
Date Tue, 19 Jun 2007 15:35:28 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506215
] 

Pavel Pervov commented on HARMONY-4238:
---------------------------------------

The same holds true for reflection.

I'll fix this some time later if no one outruns me.

> [drlvm][kernel] Race conditions in statics initialization
> ---------------------------------------------------------
>
>                 Key: HARMONY-4238
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4238
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Pavel Pervov
>
> It is known problem on Windows - statics are compiled the way their initialization is
not thread safe.
> The construct like this:
> void bar() {
>     static A* a = new A();
>     a->foo();
> }
> may produce access violation.
> I suggest changing that code to
> void bar()
> {
>     static A a;
>     if(a == NULL) {
>         a = new A();
>     }
>     a->foo();
> }
> This may produce multiple initializations but if we can guarantee that second (and all
subsequent) initialization returns the same result - it is false-positive.
> I fixed one place described in HARMONY-4230 but about 4 more places are left in kernel
classes' natives which are sources of such race conditions.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message