Skip to content

sharedtables.withValue causes deadlock on OSX (cf recent CI freezes) #18176

@timotheecour

Description

@timotheecour

refs #18172 (comment)

Example

when true:
  import std/sharedtables
  var table: SharedTable[string, string]
  init(table)

  table["a"] = "x"
  table["b"] = "y"
  table["c"] = "z"


  table.withValue("a", value):
    value[] = "m"

  table.withValue("d", value):
    discard value
    doAssert false
  do: # if "d" notin table
    table["d"] = "n"

  assert table.mget("a") == "m"
  assert table.mget("d") == "n"

Current Output

hangs, after ^C I get:

Traceback (most recent call last)
/Users/timothee/git_clone/nim/timn/tests/nim/all/t12358.nim(22) t12358
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/collections/sharedtables.nim(57) []=
SIGINT: Interrupted by Ctrl-C.

Expected Output

works

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions