Closed Richard-Stump closed 4 months ago
Multiple threads writing to stdout can cause utf-8 encoding errors. This is likely due to stdout not being atomic, or maybe the design of our VFS. A closer look needs to be taken to determine the issue here.
Program to replicate bug:
#include <iostream> #include "main.h" using namespace pros; void my_task(void* str) { pros::Vision vision(20); while (true) { std::cout << (char*)str << std::endl; std::cout << vision.get_object_count() << std::endl; pros::delay(20); } } void opcontrol() { { std::string s = "Hello world"; pros::rtos::Task t(my_task, (void*)(s.c_str())); } while (true) { pros::Motor(11).move(pros::Controller(E_CONTROLLER_MASTER).get_analog(E_CONTROLLER_ANALOG_LEFT_Y)); pros::Motor(1).move(-pros::Controller(E_CONTROLLER_MASTER).get_analog(E_CONTROLLER_ANALOG_RIGHT_Y)); std::cout << ("Hello from opcontrol\n") << std::endl; pros::Task::delay(20); } }
Should have been fixed in this PR above ^
Multiple threads writing to stdout can cause utf-8 encoding errors. This is likely due to stdout not being atomic, or maybe the design of our VFS. A closer look needs to be taken to determine the issue here.
Program to replicate bug: