Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/embedded-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ on:
- 'vm/JavaAPI/src/**'
- 'maven/linux/**'
- 'scripts/embedded/**'
- 'vm/backend/**'
- '.github/workflows/embedded-linux.yml'
pull_request:
paths:
Expand All @@ -35,6 +36,7 @@ on:
- 'vm/JavaAPI/src/**'
- 'maven/linux/**'
- 'scripts/embedded/**'
- 'vm/backend/**'
- '.github/workflows/embedded-linux.yml'

concurrency:
Expand Down Expand Up @@ -70,7 +72,7 @@ jobs:
RETRY_DELAY_SECONDS: '60'
run: |
cd maven
bash ../scripts/ci/retry.sh mvn -B -pl core,linux -am install \
bash ../scripts/ci/retry.sh mvn -B -pl core,linux,backend,codenameone-maven-plugin -am install \
-DskipTests -Dmaven.javadoc.skip=true -Plocal-dev-javase \
-Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true \
-Dmaven.repo.local="$GITHUB_WORKSPACE/.m2-repo"
Expand Down Expand Up @@ -119,6 +121,24 @@ jobs:
--reference "$B/result/frame60.png" "$B/result/gpu/demo.log" "$B/result/gpu/frame60.png" \
"$GITHUB_STEP_SUMMARY"

# The real-time check (vm/backend/demo/rtcheck): a 1 kHz loop beside a thread
# that keeps the collector busy, a cycle that allocates where the build cannot
# see it, and the memory limit. Run as root so SCHED_FIFO and mlockall apply.
# The runner's kernel is not PREEMPT_RT and its cores are shared, so the
# latency is reported and bounded loosely (20ms): what this gates is that the
# collector never stops the loop, which shows up as a missed run of periods,
# not as tens of microseconds.
- name: Real-time threads under collector load
run: |
bash scripts/ci/apt-get-update.sh
sudo apt-get install -y clang libssl-dev libnghttp2-dev libcurl4-openssl-dev
export JDK_8_HOME="$JAVA_HOME"
(cd vm/backend && CN1_BACKEND_DEMO=demo/rtcheck \
./build.sh RtCheck com.demo "$RUNNER_TEMP/rtcheck")
sudo timeout 120 "$RUNNER_TEMP/rtcheck" 10 20000 | tee "$RUNNER_TEMP/rtcheck.log"
grep '^RTCHECK' "$RUNNER_TEMP/rtcheck.log" >> "$GITHUB_STEP_SUMMARY"
grep -q '^RTCHECK OK' "$RUNNER_TEMP/rtcheck.log"

- name: Upload the run
if: always()
uses: actions/upload-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/parparvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ on:
- 'CodenameOne/src/com/codename1/impl/SharedWithBackend.java'
- 'CodenameOne/src/com/codename1/impl/orm/**'
- 'CodenameOne/src/com/codename1/hardware/**'
- 'CodenameOne/src/com/codename1/realtime/**'
- 'CodenameOne/src/com/codename1/qrcode/QrCode.java'
- 'CodenameOne/src/com/codename1/impl/MdnsEngine.java'
- 'CodenameOne/src/com/codename1/orm/session/**'
Expand Down Expand Up @@ -130,6 +131,7 @@ on:
- 'CodenameOne/src/com/codename1/impl/SharedWithBackend.java'
- 'CodenameOne/src/com/codename1/impl/orm/**'
- 'CodenameOne/src/com/codename1/hardware/**'
- 'CodenameOne/src/com/codename1/realtime/**'
- 'CodenameOne/src/com/codename1/qrcode/QrCode.java'
- 'CodenameOne/src/com/codename1/impl/MdnsEngine.java'
- 'CodenameOne/src/com/codename1/orm/session/**'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8703,6 +8703,13 @@ public com.codename1.hardware.Hardware getHardware() {
return null;
}

/// Returns the port's real-time entry point. Default implementation returns
/// `null`, which leaves [com.codename1.realtime.Realtime#getInstance()] on its
/// best-effort Java default; ports with real-time scheduling override this.
public com.codename1.realtime.Realtime getRealtime() {
return null;
}

/// Returns the port-specific local calendar source, or null when the port
/// has no device calendar integration.
public com.codename1.calendar.LocalCalendarSource getLocalCalendarSource() {
Expand Down
37 changes: 37 additions & 0 deletions CodenameOne/src/com/codename1/realtime/AllocationAllowed.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2026, Codename One and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Codename One designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Codename One through http://www.codenameone.com/ if you
* need additional information or have any questions.
*/
package com.codename1.realtime;

/// Marks a method that a [RealtimeTask]'s `cycle()` may call although it allocates.
///
/// The build checks every method that `cycle()` and `periodsMissed(int)` reach and
/// fails on an allocation. This annotation tells the check to stop at the marked method
/// instead, for a path that allocates only in a case the application has accounted for,
/// such as a rare event that is logged. At run time such a path still counts against the
/// thread's allocation budget ([RealtimeParameters#setAllocationBudget(int)]); with the
/// default budget of zero it ends the steady state with a [RealtimeAllocationError].
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS)
@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR})
@com.codename1.impl.SharedWithBackend
public @interface AllocationAllowed {
}
Loading
Loading