shared monitor implementation with a conditional variable

or a ring buffer with semaphores
This commit is contained in:
Michael Krasnyk
2017-02-03 13:39:44 +01:00
committed by Patrick Niklaus
parent 438aa66b4c
commit 82acd59a8e
10 changed files with 310 additions and 170 deletions
+5 -3
View File
@@ -12,7 +12,7 @@ module.exports = function () {
};
this.runAndSafeOutput = (binary, options, callback) => {
this.runBin(binary, this.expandOptions(options), this.environment, (err, stdout, stderr) => {
return this.runBin(binary, this.expandOptions(options), this.environment, (err, stdout, stderr) => {
this.stdout = stdout;
this.stderr = stderr;
this.exitCode = err && err.code || 0;
@@ -53,8 +53,10 @@ module.exports = function () {
this.runAndSafeOutput('osrm-contract', options, () => { callback(); });
});
this.When(/^I run "osrm\-datastore\s?(.*?)"$/, (options, callback) => {
this.runAndSafeOutput('osrm-datastore', options, callback);
this.When(/^I run "osrm\-datastore\s?(.*?)"(?: with input "([^"]*)")?$/, (options, input, callback) => {
let child = this.runAndSafeOutput('osrm-datastore', options, callback);
if (input !== undefined)
child.stdin.write(input);
});
this.Then(/^it should exit successfully$/, () => {
+16
View File
@@ -22,6 +22,22 @@ Feature: Ways of loading data
| a | b | ab,ab |
| b | a | ab,ab |
Scenario: osrm-datastore - Remove shared control block
When I run "osrm-datastore --remove-locks"
Then stderr should be empty
And it should exit successfully
Scenario: osrm-datastore - Remove shared memory blocks
When I run "osrm-datastore --spring-clean" with input "Y"
Then stderr should be empty
And it should exit successfully
Scenario: osrm-datastore - Fail if no shared memory blocks are loaded
When I run "osrm-datastore --spring-clean" with input "Y"
And I try to run "osrm-routed --shared-memory=1"
Then stderr should contain "No shared memory block"
And it should exit with an error
Scenario: Load data directly - st
Given data is loaded directly
Given the node map
+15 -6
View File
@@ -22,18 +22,27 @@ Feature: Via points
Given the contract extra arguments "--core 0.8"
Given the node map
"""
a b c
a b c d
e f g
h i
j
"""
And the ways
| nodes |
| abc |
| abcd |
| efg |
| hi |
| be |
| cfh |
| dgij |
When I route I should get
| waypoints | route |
| a,b,c | abc,abc,abc,abc |
| c,b,a | abc,abc,abc,abc |
| c,b,a | abc,abc,abc,abc |
| waypoints | route |
| a,b,c | abcd,abcd,abcd,abcd |
| c,b,a | abcd,abcd,abcd,abcd |
| a,d,j | abcd,abcd,dgij,dgij |
| j,d,a | dgij,dgij,abcd,abcd |
Scenario: Via point at a dead end
Given the node map