FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mercury/java/runtime/MercuryRuntime.java at master · Mercury-Language/mercury · GitHub
Mercury-Language
/
mercury
Public
Notifications
You must be signed in to change notification settings
Fork
71
Star
1.1k
Code
Issues
13
Pull requests
8
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
mercury
/
java
/
runtime
/
MercuryRuntime.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
78 lines (70 loc) · 2.13 KB
Breadcrumbs
mercury
/
java
/
runtime
/
MercuryRuntime.java
Copy path
File metadata and controls
78 lines (70 loc) · 2.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// vim: ts=4 sw=4 expandtab ft=java
//
// Copyright (C) 2014, 2018 The Mercury Team
// This file is distributed under the terms specified in COPYING.LIB.
//
package
jmercury
.
runtime
;
/**
* Interface to the Mercury Runtime System for Java code.
*
* No instance of this class is ever created, all its members and methods
* are static.
*/
public
class
MercuryRuntime
{
/**
* Private constructor.
* This private constructor doesn't do anything and isn't called by
* anyone. It exists only to prevent people from creating an instance.
*/
private
MercuryRuntime
() {
}
private
static
MercuryThreadPool
thread_pool
=
null
;
/**
* Return the thread pool, initialising it if required.
* This does not start the thread pool. It is started either when
* startup() is called or automatically when the first task is
* submitted.
*/
public
static
synchronized
MercuryThreadPool
getThreadPool
()
{
if
(
thread_pool
==
null
) {
thread_pool
=
new
MercuryThreadPool
(
JavaInternal
.
getOptions
().
getNumProcessors
());
}
return
thread_pool
;
}
/**
* Retrieve the exit status stored in the I/O state.
*/
public
static
int
getExitStatus
() {
return
JavaInternal
.
exit_status
;
}
/**
* Finalise the runtime system.
* This _must_ be called at the end of any program. It runs finalisers
* and stops the thread pool. This will wait for the thread pool
* to shutdown (unless abort=true).
*/
public
static
void
finalise
(
boolean
abort
) {
MercuryThreadPool
pool
;
pool
=
getThreadPool
();
if
(!
abort
) {
JavaInternal
.
run_finalisers
();
}
pool
.
shutdown
(
abort
);
if
(!
abort
) {
pool
.
waitForShutdown
();
}
}
/**
* Finalise the runtime system.
* This _must_ be called at the end of any program. It runs finalisers
* and stops the thread pool. This will wait for the thread pool
* to shutdown.
* This is the same as calling finalise(false)
*/
public
static
void
finalise
() {
finalise
(
false
);
}
}
Back
|
FazBrowse Home
|
New Git URL