Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
12d947bb
Commit
12d947bb
authored
9 years ago
by
Adam Welc
Browse files
Options
Downloads
Patches
Plain Diff
Closing a closed channel does not have to be an error.
parent
3bcbc574
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RChannel.java
+10
-4
10 additions, 4 deletions
....r.runtime/src/com/oracle/truffle/r/runtime/RChannel.java
with
10 additions
and
4 deletions
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RChannel.java
+
10
−
4
View file @
12d947bb
...
...
@@ -54,6 +54,8 @@ public class RChannel {
private
static
int
[]
keys
=
new
int
[
INITIAL_CHANNEL_NUM
];
private
static
RChannel
[]
channels
=
new
RChannel
[
INITIAL_CHANNEL_NUM
];
private
static
final
int
CLOSED_CHANNEL_KEY
=
-
1
;
/*
* Used to mediate access to the semaphore instances
*/
...
...
@@ -63,8 +65,8 @@ public class RChannel {
private
final
ArrayBlockingQueue
<
Object
>
clientToMaster
=
new
ArrayBlockingQueue
<>(
QUEUE_CAPACITY
);
public
static
int
createChannel
(
int
key
)
{
if
(
key
=
=
0
)
{
throw
RError
.
error
(
RError
.
SHOW_CALLER2
,
RError
.
Message
.
GENERIC
,
"channel's key must be
non-zero
"
);
if
(
key
<
=
0
)
{
throw
RError
.
error
(
RError
.
SHOW_CALLER2
,
RError
.
Message
.
GENERIC
,
"channel's key must be
positive
"
);
}
try
{
create
.
acquire
();
...
...
@@ -124,9 +126,13 @@ public class RChannel {
try
{
create
.
acquire
();
if
(
actualId
==
0
||
actualId
>=
channels
.
length
||
channels
[
actualId
]
==
null
)
{
throw
RError
.
error
(
RError
.
SHOW_CALLER2
,
RError
.
Message
.
GENERIC
,
"channel with specified id does not exist"
);
// closing an already closed channel does not necessarily have to be an error (and
// makes parallell package's worker script work unchanged)
if
(
keys
[
actualId
]
!=
CLOSED_CHANNEL_KEY
)
{
throw
RError
.
error
(
RError
.
SHOW_CALLER2
,
RError
.
Message
.
GENERIC
,
"channel with specified id does not exist"
);
}
}
keys
[
actualId
]
=
0
;
keys
[
actualId
]
=
CLOSED_CHANNEL_KEY
;
channels
[
actualId
]
=
null
;
}
catch
(
InterruptedException
x
)
{
throw
RError
.
error
(
RError
.
SHOW_CALLER2
,
RError
.
Message
.
GENERIC
,
"error closing channel"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment