Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahr committed Jan 25, 2021
1 parent bc52982 commit 1eb34e3
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 149 deletions.
9 changes: 9 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -ueo pipefail

if [ -n "${LINTBALL_DIR:-}" ]; then
"${LINTBALL_DIR}/bin/lintball" pre-commit
else
lintball pre-commit
fi
8 changes: 6 additions & 2 deletions .github/workflows/build-latest-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# yamllint disable rule:line-length
# yamllint disable rule:comments

name: Build
on:
pull_request:
Expand All @@ -7,11 +10,12 @@ on:
paths-ignore:
- README.md
schedule:
- cron: "0 0 * * *" # daily at midnight
- cron: '0 0 * * *' # daily at midnight

jobs:
build:
name: Test nim-${{ matrix.nim-version }} / ${{ matrix.runs-on }}
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
Expand All @@ -23,7 +27,7 @@ jobs:

runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout Nim project
- name: Checkout project
uses: actions/checkout@v2

- name: Install nim
Expand Down
32 changes: 6 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# yamllint disable rule:line-length

name: Build
on:
pull_request:
Expand All @@ -13,6 +15,7 @@ env:
jobs:
test_x86:
name: Test nim-${{ matrix.nim-version }} / ${{ matrix.runs-on }} / x86_64
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
Expand All @@ -21,29 +24,16 @@ jobs:
nim-version: 1.4.2
- runs-on: ubuntu-latest
nim-version: 1.2.8

runs-on: ${{ matrix.runs-on }}
steps:
- name: Disable tcp/udp offloading
run: |
# Prevent network slowness
# See https://github.com/actions/virtual-environments/issues/1187#issuecomment-696195756
# and https://github.com/enso-org/enso/pull/1159
if [ "${{ runner.os }}" == "macOS" ]; then
sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0
else
sudo ethtool -K eth0 tx off rx off
fi
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
uses: actions/cache@v2
with:
path: ${HOME}/.cache
key: cache-${{ matrix.runs-on }}-${{ matrix.nim-version }}

- name: Checkout Nim project
- name: Checkout project
uses: actions/checkout@v2

- name: Install nim
Expand All @@ -54,12 +44,14 @@ jobs:
- name: Run tests
run: |
source ~/.asdf/asdf.sh
nimble develop -y
nimble test
nimble examples
test_non_x86:
name: Test nim-${{ matrix.nim-version }} / debian-buster / ${{ matrix.arch }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
Expand All @@ -74,18 +66,6 @@ jobs:

runs-on: ubuntu-latest
steps:
- name: Disable tcp/udp offloading
run: |
# Prevent network slowness
# See https://github.com/actions/virtual-environments/issues/1187#issuecomment-696195756
# and https://github.com/enso-org/enso/pull/1159
if [ "${{ runner.os }}" == "macOS" ]; then
sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0
else
sudo ethtool -K eth0 tx off rx off
fi
# Optimization: re-use cached Nim->C compilation
- name: Restore cache
uses: actions/cache@v2
Expand Down
30 changes: 14 additions & 16 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"macFrameworkPath": [],
"compilerPath": "/usr/local/opt/gcc/bin/gcc-9",
"cStandard": "c11",
"cppStandard": "gnu++14",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
"configurations": [
{
"name": "Mac",
"includePath": ["${workspaceFolder}/**"],
"defines": [],
"macFrameworkPath": [],
"compilerPath": "/usr/local/opt/gcc/bin/gcc-9",
"cStandard": "c11",
"cppStandard": "gnu++14",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
48 changes: 24 additions & 24 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug tests (cppdbg)",
"type": "cppdbg",
"MIMode": "lldb",
"request": "launch",
"program": "${workspaceRoot}/tests/test",
// "args": ["Mupmuc[N, P, C, T] threaded::"],
"cwd": "${workspaceRoot}",
},
{
"name": "Debug examples (cppdbg)",
"type": "cppdbg",
"MIMode": "lldb",
"request": "launch",
"program": "${workspaceRoot}/examples/mupsic",
// "args": ["ops.used(head, tail, capacity)::"],
"cwd": "${workspaceRoot}",
}
]
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug tests (cppdbg)",
"type": "cppdbg",
"MIMode": "lldb",
"request": "launch",
"program": "${workspaceRoot}/tests/test",
// "args": ["Mupmuc[N, P, C, T] threaded::"],
"cwd": "${workspaceRoot}"
},
{
"name": "Debug examples (cppdbg)",
"type": "cppdbg",
"MIMode": "lldb",
"request": "launch",
"program": "${workspaceRoot}/examples/mupsic",
// "args": ["ops.used(head, tail, capacity)::"],
"cwd": "${workspaceRoot}"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"nim.buildOnSave": true
}
115 changes: 56 additions & 59 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,56 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build tests",
"command": "nim",
"args": [
"c",
"tests/test.nim"
],
"options": {
"cwd": "${workspaceRoot}"
},
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Run tests",
"command": "tests/test",
"options": {
"cwd": "${workspaceRoot}"
},
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
}
},
// {
// "label": "Build example 'sipsicqueuestatic'",
// "command": "nim",
// "args": [
// "c",
// "examples/sipsicqueuestatic.nim"
// ],
// "options": {
// "cwd": "${workspaceRoot}"
// },
// "type": "shell",
// "group": "build"
// },
// {
// "label": "Build mupsic_static_queue",
// "command": "nim",
// "args": [
// "c",
// "src/lockfreequeues/mupsic_static_queue.nim"
// ],
// "options": {
// "cwd": "${workspaceRoot}"
// },
// "type": "shell",
// "group": "build"
// },
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "Build tests",
"command": "nim",
"args": ["c", "tests/test.nim"],
"options": {
"cwd": "${workspaceRoot}"
},
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Run tests",
"command": "tests/test",
"options": {
"cwd": "${workspaceRoot}"
},
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
}
}
// {
// "label": "Build example 'sipsicqueuestatic'",
// "command": "nim",
// "args": [
// "c",
// "examples/sipsicqueuestatic.nim"
// ],
// "options": {
// "cwd": "${workspaceRoot}"
// },
// "type": "shell",
// "group": "build"
// },
// {
// "label": "Build mupsic_static_queue",
// "command": "nim",
// "args": [
// "c",
// "src/lockfreequeues/mupsic_static_queue.nim"
// ],
// "options": {
// "cwd": "${workspaceRoot}"
// },
// "type": "shell",
// "group": "build"
// },
]
}
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ The contributors are listed in AUTHORS (add yourself). This project uses the MIT

Please read these documents before you send a patch:

* New functionality should be covered by a unit test.

* If a bug is being fixed, please add a unit test that would fail without the bug fix.
- New functionality should be covered by a unit test.

- If a bug is being fixed, please add a unit test that would fail without the bug fix.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ nimble examples

## Reference

* Juho Snellman's post ["I've been writing ring buffers wrong all these years"](https://www.snellman.net/blog/archive/2016-12-13-ring-buffers/) ([alt](https://web.archive.org/web/20200530040210/https://www.snellman.net/blog/archive/2016-12-13-ring-buffers/))
* Mamy Ratsimbazafy's [research on SPSC channels](https://github.com/mratsim/weave/blob/master/weave/cross_thread_com/channels_spsc.md#litterature) for weave.
* Henrique F Bucher's post ["Yes, You Have Been Writing SPSC Queues Wrong Your Entire Life"](http://www.vitorian.com/x1/archives/370) ([alt](https://web.archive.org/web/20191225164231/http://www.vitorian.com/x1/archives/370))
- Juho Snellman's post ["I've been writing ring buffers wrong all these years"](https://www.snellman.net/blog/archive/2016-12-13-ring-buffers/) ([alt](https://web.archive.org/web/20200530040210/https://www.snellman.net/blog/archive/2016-12-13-ring-buffers/))
- Mamy Ratsimbazafy's [research on SPSC channels](https://github.com/mratsim/weave/blob/master/weave/cross_thread_com/channels_spsc.md#litterature) for weave.
- Henrique F Bucher's post ["Yes, You Have Been Writing SPSC Queues Wrong Your Entire Life"](http://www.vitorian.com/x1/archives/370) ([alt](https://web.archive.org/web/20191225164231/http://www.vitorian.com/x1/archives/370))

Many thanks to Mamy Ratsimbazafy for reviewing the initial release and offering suggestions.

## Contributing

* Pull requests and feature requests are quite welcome!
* Please file any issues you encounter.
* For pull requests, please see the [contribution guidelines](https://github.com/elijahr/lockfreequeues/tree/master/CONTRIBUTING.md).
- Pull requests and feature requests are quite welcome!
- Please file any issues you encounter.
- For pull requests, please see the [contribution guidelines](https://github.com/elijahr/lockfreequeues/tree/master/CONTRIBUTING.md).

## Running tests

Expand All @@ -54,22 +54,22 @@ Nightly builds look for and test against the latest release of Nim.

### v2.0.5 - 2021-01-06

* Moved from Travis CI to GitHub Actions.
- Moved from Travis CI to GitHub Actions.

### v2.0.4 - 2020-08-10

* Implement multi-producer, single-consumer queue (Mupsic)
* Implement multi-producer, multi-consumer queue (Mupmuc)
* Refactor, remove shared memory queues
* Fix wrap-around bug, improve test coverage
* Nicer examples
- Implement multi-producer, single-consumer queue (Mupsic)
- Implement multi-producer, multi-consumer queue (Mupmuc)
- Refactor, remove shared memory queues
- Fix wrap-around bug, improve test coverage
- Nicer examples

### v1.0.0 - 2020-07-06

* Addresses feedback from [#1](https://github.com/elijahr/lockfreequeues/issues/1)
* `head` and `tail` are now in the range `0 ..<2*capacity`
* `capacity` doesn’t have to be a power of two
* Use `align` pragma instead of padding array
- Addresses feedback from [#1](https://github.com/elijahr/lockfreequeues/issues/1)
- `head` and `tail` are now in the range `0 ..<2*capacity`
- `capacity` doesn’t have to be a power of two
- Use `align` pragma instead of padding array

### v0.1.0 - 2020-07-02

Expand Down
Loading

0 comments on commit 1eb34e3

Please sign in to comment.