Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Thread pool task user index is wrong

Open Murtagy opened this issue 2 years ago • 1 comments

Context

        Odin: dev-2022-11:f1c24f43
        OS:   macOS Unknown (build: 22A380, kernel: 22.1.0)
        CPU:  Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
        RAM:  8192 MiB

Present on MacOS 13.0 (Ventura), also was present at 12.X

llvm-config --version
14.0.6

Steps to Reproduce

package main

import "core:fmt"
import "core:thread"
import "core:time"

empty_task :: proc(t: thread.Task) {
    for {
        fmt.println("user index should be 1:", t.user_index)
        time.sleep(1 * time.Second)
    }
}

main :: proc() {
    pool: thread.Pool
    thread.pool_init(pool=&pool, thread_count=3, allocator=context.allocator)
    thread.pool_add_task(
        pool=&pool,
        procedure=empty_task,
        data=nil,
        user_index=1,
        allocator=context.allocator,
    )
    thread.pool_start(&pool)
    defer thread.pool_destroy(&pool)

    for {}
}

Current Behavior

user index should be 1 - 123145336991528

Expected Behavior

user index should be 1 - 1

Murtagy avatar Nov 10 '22 19:11 Murtagy

Seems to be MacOS specific https://discord.com/channels/568138951836172421/1033997052411129857/1040182670719733821

Murtagy avatar Nov 10 '22 19:11 Murtagy