master
 1const std = @import("std");
 2const assert = std.debug.assert;
 3
 4threadlocal var x: i32 = 1234;
 5
 6test "thread local storage" {
 7    const thread1 = try std.Thread.spawn(.{}, testTls, .{});
 8    const thread2 = try std.Thread.spawn(.{}, testTls, .{});
 9    testTls();
10    thread1.join();
11    thread2.join();
12}
13
14fn testTls() void {
15    assert(x == 1234);
16    x += 1;
17    assert(x == 1235);
18}
19
20// test