From 00464bf784e851ee35288982cae3a60430a47cb2 Mon Sep 17 00:00:00 2001 From: depetrol Date: Thu, 17 Oct 2024 15:36:47 -0700 Subject: [PATCH 1/5] fix concurrency and add test --- .../federated/extensions/CExtension.java | 2 +- core/src/main/resources/lib/c/reactor-c | 2 +- .../src/concurrent/ConcurrentActionRepeat.lf | 45 +++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 test/Python/src/concurrent/ConcurrentActionRepeat.lf diff --git a/core/src/main/java/org/lflang/federated/extensions/CExtension.java b/core/src/main/java/org/lflang/federated/extensions/CExtension.java index 025d20749a..edf5bc8d19 100644 --- a/core/src/main/java/org/lflang/federated/extensions/CExtension.java +++ b/core/src/main/java/org/lflang/federated/extensions/CExtension.java @@ -387,7 +387,7 @@ protected void serializeAndSend( result.pr( "size_t _lf_message_length = " + sendRef - + "->token->length * " + + "->length * " + sendRef + "->token->type->element_size;"); result.pr( diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 184567d3bd..3d7715c39f 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 184567d3bd06ae5c5f8a75a0b51093115e7fbe52 +Subproject commit 3d7715c39fc40ad3c4c29918e724dc5b96738ca5 diff --git a/test/Python/src/concurrent/ConcurrentActionRepeat.lf b/test/Python/src/concurrent/ConcurrentActionRepeat.lf new file mode 100644 index 0000000000..66c312986f --- /dev/null +++ b/test/Python/src/concurrent/ConcurrentActionRepeat.lf @@ -0,0 +1,45 @@ +target Python + +reactor ConcurrentActionTest { + state logs + physical action addlog_action + + reaction(startup) -> addlog_action {= + print("Starting WebServer") + import time + import threading + self.logs = [] + def testall(): + def test(i): + print(f"Scheduling action {i}") + addlog_action.schedule(0, f"{i}") + + threads = [] + for j in range(100): + self.logs = [] + for i in range(100): + test_thread = threading.Thread(target=test, args=(j*100 + i,)) + test_thread.start() + threads.append(test_thread) + for thread in threads: + thread.join() + time.sleep(0.1) + print(f"===== Test {j} complete =====") + os._exit(0) + testall_thread = threading.Thread(target=testall) + testall_thread.start() + =} + + reaction(addlog_action) {= + if addlog_action.value in self.logs: + print(f"Duplicate Action: {addlog_action.value}") + raise Exception("Duplicate Action") + else: + print(f"Action: {addlog_action.value}") + self.logs.append(addlog_action.value) + =} +} + +main reactor { + server = new ConcurrentActionTest() +} From d6bb04b180efb7cfdefd359fe15423c0bb94c248 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Sun, 20 Oct 2024 15:56:15 -0700 Subject: [PATCH 2/5] Update all-misc.yml --- .github/workflows/all-misc.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/all-misc.yml b/.github/workflows/all-misc.yml index 1155170fc1..e2aae3d1ff 100644 --- a/.github/workflows/all-misc.yml +++ b/.github/workflows/all-misc.yml @@ -41,14 +41,6 @@ jobs: with: all-platforms: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} - # Run language server tests. - lsp: - if: ${{ needs.check-diff.outputs.run_misc == 'true' }} - needs: check-diff - uses: ./.github/workflows/lsp-tests.yml - with: - all-platforms: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} - check-labels: uses: ./.github/workflows/check-labels.yml if: ${{ github.event_name == 'pull_request' }} From 9a93cf65fcf65740ace6e37de48216de3cd25370 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Sun, 20 Oct 2024 15:58:39 -0700 Subject: [PATCH 3/5] Update lsp-tests.yml --- .github/workflows/lsp-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lsp-tests.yml b/.github/workflows/lsp-tests.yml index 0a50fbf85a..a1568dbcd5 100644 --- a/.github/workflows/lsp-tests.yml +++ b/.github/workflows/lsp-tests.yml @@ -1,6 +1,7 @@ name: Language server tests on: + workflow_dispatch: workflow_call: inputs: all-platforms: From 6175dc468c81cf66ebe313b3f78cec8a4733d24d Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Sun, 20 Oct 2024 15:59:56 -0700 Subject: [PATCH 4/5] Update lsp-tests.yml --- .github/workflows/lsp-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/lsp-tests.yml b/.github/workflows/lsp-tests.yml index a1568dbcd5..a724ed42e1 100644 --- a/.github/workflows/lsp-tests.yml +++ b/.github/workflows/lsp-tests.yml @@ -1,6 +1,9 @@ name: Language server tests on: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '0 8 * * 6' workflow_dispatch: workflow_call: inputs: From ec47a9161ca62c6691162aabea1214a734387a5d Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 21 Oct 2024 22:07:55 -0700 Subject: [PATCH 5/5] Update README.md --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5af0226c8d..6ad4e01a6c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [Website](https://lf-lang.org/) | [Documentation](https://www.lf-lang.org/docs/) | -[Download](https://www.lf-lang.org/docs/installation) | +[Installation](https://www.lf-lang.org/docs/installation) | [Contributing](CONTRIBUTING.md) | [Changelog](CHANGELOG.md) @@ -8,7 +8,10 @@ [![CI (misc)](https://github.com/lf-lang/lingua-franca/actions/workflows/all-misc.yml/badge.svg)](https://github.com/lf-lang/lingua-franca/actions/workflows/all-misc.yml?query=branch%3Amaster) [![CI (misc)](https://github.com/lf-lang/lingua-franca/actions/workflows/all-embedded.yml/badge.svg)]([https://github.com/lf-lang/lingua-franca/actions/](https://github.com/lf-lang/lingua-franca/actions/workflows/all-embedded.yml?query=branch%3Amaster)) -[![Nightly Build](https://github.com/lf-lang/lingua-franca/actions/workflows/nightly-build.yml/badge.svg)](https://github.com/lf-lang/lingua-franca/actions/workflows/nightly-build.yml) +[![Open VSX Downloads](https://img.shields.io/open-vsx/dt/lf-lang/vscode-lingua-franca?label=Open%20VSX%20Registry%20%E2%A4%93)](https://open-vsx.org/extension/lf-lang/vscode-lingua-franca) +[![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/lf-lang.vscode-lingua-franca?label=VS%20Marketplace%20%E2%A4%93)](https://marketplace.visualstudio.com/items?itemName=lf-lang.vscode-lingua-franca) +[![Nightly Build](https://github.com/lf-lang/lingua-franca/actions/workflows/nightly-build.yml/badge.svg)](https://github.com/lf-lang/lingua-franca/releases/tag/nightly) + [![CodeCov](https://codecov.io/gh/lf-lang/lingua-franca/branch/master/graph/badge.svg?token=b7LrpihI5a)](https://codecov.io/gh/lf-lang/lingua-franca) [![GitHub Contributors](https://img.shields.io/github/contributors/lf-lang/lingua-franca)](https://github.com/lf-lang/lingua-franca/graphs/contributors) [![Zulip](https://img.shields.io/badge/chat-zulip-informational)](https://lf-lang.zulipchat.com) @@ -19,6 +22,4 @@ Lingua Franca (LF) is a polyglot coordination language for concurrent and possibly time-sensitive applications ranging from low-level embedded code to distributed cloud and edge applications. An LF program specifies the interactions between components called reactors. The emphasis of the framework is on ensuring deterministic interaction with explicit management of timing. The logic of each reactor is written in one of a suite of target languages (currently C, C++, Python, and TypeScript) and can integrate legacy code in those languages. A code generator synthesizes one or more programs in the target language, which are then compiled using standard toolchains. If the application has exploitable parallelism, then it executes transparently on multiple cores without compromising determinacy. A distributed application translates into multiple programs and scripts to launch those programs on distributed machines. The communication fabric connecting components is synthesized as part of the programs. -See [lf-lang.org](https://lf-lang.org) for installation instructions and documentation. See also the [wiki](https://github.com/icyphy/lingua-franca/wiki) for further information on ongoing projects. - -See our [Publications and Presentations](https://www.lf-lang.org/research/). +See [lf-lang.org](https://lf-lang.org) for [installation instructions](https://www.lf-lang.org/docs/installation), [documentation](https://www.lf-lang.org/docs/), and [research papers](https://www.lf-lang.org/research/). See also the [wiki](https://github.com/lf-lang/lingua-franca/wiki/) for further information on ongoing projects.