You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Pavel Pervov (JIRA)" <ji...@apache.org> on 2007/06/19 17:35:28 UTC

[jira] Commented: (HARMONY-4238) [drlvm][kernel] Race conditions in statics initialization

    [ 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.