harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Salikh Zakirov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-1789) [DRLVM] Race condition between Thread.interrupt and Object.wait, Thread.sleep or join
Date Wed, 15 Nov 2006 18:50:41 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-1789?page=comments#action_12450150 ] 
Salikh Zakirov commented on HARMONY-1789:

Some comments on the H-1789.patch. Nikolay, could you please review?
If you have no objections, I would implement commens and attach updated patch.

1) fflush(NULL); seems to be unrelated and, in fact, it mustn't be there (it can change the
I/O behaviour from expected)

2) What is the reason for introducing interrupter_thread_function() running in a separate
I guess the following substitution will do just as well (and without new threads):

-        if (thread->monitor && (hythread_monitor_try_enter(thread->monitor)
-            hythread_monitor_notify_all(thread->monitor);
-            hythread_monitor_exit(thread->monitor);
-        } else {
-            status = hythread_create(&thread->interrupter, 0, 0, 0, interrupter_thread_function,
(void *)thread);
-            assert (status == TM_ERROR_NONE);
-        }
+        if (thread->monitor) { hycond_notify(thread->monitor->condition); }

and instead of doing 
  wait_count = 0
in notify_all() we could decrease wait_count in the waiting thread just after condvar_wait_impl()

3) the two changes to Thread.java looks to me as unrelated to both this issue and each other.
(and therefore should not be committed together with this patch)
By the way, why we have a waiting loop in Thread.start() at all? Spec does not mandate it.
-- I think I would file a separate JIRA to remove this loop.

4) sleep_event and park_event are not used anymore and should be cleaned up

5) commented out code should be removed, and some style corrected

> [DRLVM] Race condition between Thread.interrupt and Object.wait, Thread.sleep or join
> -------------------------------------------------------------------------------------
>                 Key: HARMONY-1789
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1789
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Nikolay Kuznetsov
>         Assigned To: Alexey Varlamov
>         Attachments: H-1789.patch, HARMONY1789.java, Test.java
> According to the specification wait/join or sleep methods should check if thread was
interrupted before entering wait. DRLVM hythread implmentation do checks interrupted status(see
hythread condition implmentation), however thread may be interrupted just after the status
was checked and before entering condition wait. Thus it's required to ensure that waiting
state will be reached having interrupted status unchanged.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message