Skip to content

Question on use of thread_count #38

@Defragster

Description

@Defragster

Looking at output from
char *Threads::threadsInfo(void) { static char _buffer[Threads::UTIL_TRHEADS_BUFFER_LENGTH]; uint _buffer_cursor = 0; _buffer_cursor = sprintf(_buffer, "_____\n"); for (int each_thread = 0; each_thread <= thread_count; each_thread++)
That starts on [0] to [3] with 4 added threads without the added "<=" then it runs and shows the 5 actual threads.

thread_count seems to start at 0 even though there is always 1 main thread? It is only incremented with add_thread.

Wondering about other references to thread_count in TeensyThreads.cpp that start at 0 like this:
//get lowest sleep interval from sleeping tasks into task_id_ends for (i = 0; i < thread_count; i++) {

Also - maybe threadsinfo() was meant to SKIP [0] - the stack info printed is showing bad numbers - at least on a T_3.5:
0:Stack size:10240|Used:537067512|Remains:-537057272|State:RUNNING|

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions