Skip to content

Breakpoints not working in worker threads created with sys.thread.Thread #142

Description

@acodervic
import sys.thread.Thread;
import sys.thread.Mutex;
import sys.thread.Lock;

class HelloWorld {
    static function main() {
        trace("Hello, World from Haxe!");
        test1_BasicThreads();
        }

    static function test1_BasicThreads() {

        
        var threads:Array<Thread> = [];
        
        for (i in 0...3) {
            var thread = Thread.create(function() {
                var threadId = i;
                trace('thread $threadId start');   <---- Set vscode breakpoint at this line 
                Sys.sleep(0.5);
                trace('start $threadId end');
            });
            threads.push(thread);
        }
        
    }
}

build.hxml

-hl hl_output/HelloWorld.hl
-main HelloWorld

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build HashLink Debug",
            "type": "haxe",
            "args":  "active configuration",
            "problemMatcher": "$haxe",
            "group": "build"
        }
    ]
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "HashLink (launch)",
            "request": "launch",
            "type": "hl",
            "cwd": "${workspaceFolder}",
            "preLaunchTask": {
                "type": "haxe",
                "args": "active configuration"
            },
            "program": "${workspaceFolder}/hl_output/HelloWorld.hl"
        }
     
    ]
}

console out:

HelloWorld.hx:7: Hello, World from Haxe! 
//hashlink crashed and process stop

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions