Skip to content

std::mutex is not available #8882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
6 tasks done
ghost opened this issue Mar 7, 2023 · 2 comments
Open
6 tasks done

std::mutex is not available #8882

ghost opened this issue Mar 7, 2023 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 7, 2023

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: ESP-12F
  • Core Version: PIO Core 6.1.6
  • Development Env: PlatformIO
  • Operating System: Windows

Settings in IDE

  • Module: WeMos D1 R2 and mini /
  • Flash Mode: dio
  • Flash Size: 4MB
  • lwip Variant: v1.4
  • Reset Method: ck
  • Flash Frequency: [40Mhz]
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 115200

Problem Description

std::mutex is not available. Have set up a Win10 VM and fresh installed VS Code and PIO to ensure it is not related to one of my libraries or such. Still persists.

MCVE Sketch

main.cpp:

#include <Arduino.h>

#include <mutex>

using std::mutex;

void setup() {}

void loop() {}

platformio.ini:

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino

Output

src\main.cpp:5:12: error: 'mutex' has not been declared in 'std'
    5 | using std::mutex;
      |            ^~~~~
*** [.pio\build\d1_mini\src\main.cpp.o] Error 1
@d-a-v
Copy link
Collaborator

d-a-v commented Mar 10, 2023

Our toolchain is not configured to build and provide the thread library (_GLIBCXX_HAS_GTHREADS is not defined).
There is currently no multithreading enabled in this architecture because this is useless until proven wrong:
The scheduling model of NONOS-SDK firmware on top of which we are running is single-task even though we know that freertos is running under the hood.

The arduino API cli() and sei() is implemented and accessible for global / critical locking.

edit interrupts() and noInterrupts() are their official names (thanks @dok-net for pointing this out)

@dok-net
Copy link
Contributor

dok-net commented Mar 12, 2023

According to https://www.arduino.cc/reference/en/, the portable calls are interrupts() and noInterrupts(), are they not? Obviously you must not yield() (delay(), sleep etc.) when noInterrupts() is in effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants