~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/nbody-java/native_org_xmlvm_runtime_FinalizerNotifier.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-06-11 15:45:24 UTC
  • mfrom: (1.2.1) (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130611154524-rppb3w6tixlegv4n
Tags: 1.4.7~20130611~a1eb425-1
* New snapshot release
* Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "xmlvm.h"
 
3
#include "org_xmlvm_runtime_FinalizerNotifier.h"
 
4
 
 
5
 
 
6
//XMLVM_BEGIN_NATIVE_IMPLEMENTATION
 
7
//XMLVM_END_NATIVE_IMPLEMENTATION
 
8
 
 
9
void org_xmlvm_runtime_FinalizerNotifier_preventGarbageCollection___boolean(JAVA_BOOLEAN n1)
 
10
{
 
11
    //XMLVM_BEGIN_NATIVE[org_xmlvm_runtime_FinalizerNotifier_preventGarbageCollection___boolean]
 
12
#ifndef XMLVM_NO_GC
 
13
    if (n1) {
 
14
        // Disable garbage collection.  Even GC_gcollect calls will be ineffective.
 
15
        GC_disable();
 
16
    } else {
 
17
        // Reenable garbage collection.  GC_disable() and GC_enable() calls
 
18
        // nest.  Garbage collection is enabled if the number of calls to both
 
19
        // functions is equal.
 
20
        GC_enable();
 
21
    }
 
22
#endif
 
23
    //XMLVM_END_NATIVE
 
24
}
 
25
 
 
26
JAVA_BOOLEAN org_xmlvm_runtime_FinalizerNotifier_currentThreadIsFinalizerThread___java_lang_Thread(JAVA_OBJECT n1)
 
27
{
 
28
    //XMLVM_BEGIN_NATIVE[org_xmlvm_runtime_FinalizerNotifier_currentThreadIsFinalizerThread___java_lang_Thread]
 
29
 
 
30
    // Determine if the current thread is the finalizer thread (the 1st
 
31
    // parameter).
 
32
 
 
33
    // This method is native since any methods added to proxy classes are not
 
34
    // visible to this class, such as Thread.getCurrentThreadNativeId().
 
35
 
 
36
    // return Thread.getCurrentThreadNativeId() == finalizerThread.getNativeThreadId();
 
37
    return java_lang_Thread_getCurrentThreadNativeId__() == java_lang_Thread_getNativeThreadId__(n1);
 
38
 
 
39
    //XMLVM_END_NATIVE
 
40
}
 
41
 
 
42
JAVA_BOOLEAN org_xmlvm_runtime_FinalizerNotifier_shouldInvokeFinalizers__()
 
43
{
 
44
    //XMLVM_BEGIN_NATIVE[org_xmlvm_runtime_FinalizerNotifier_shouldInvokeFinalizers__]
 
45
#ifndef XMLVM_NO_GC
 
46
    return GC_should_invoke_finalizers();
 
47
#else
 
48
    return 0;
 
49
#endif
 
50
    //XMLVM_END_NATIVE
 
51
}
 
52
 
 
53
JAVA_INT org_xmlvm_runtime_FinalizerNotifier_invokeFinalizers__()
 
54
{
 
55
    //XMLVM_BEGIN_NATIVE[org_xmlvm_runtime_FinalizerNotifier_invokeFinalizers__]
 
56
#ifndef XMLVM_NO_GC
 
57
    return GC_invoke_finalizers();
 
58
#else
 
59
    return 0;
 
60
#endif
 
61
    //XMLVM_END_NATIVE
 
62
}
 
63