1. This is _currently_ safe code. I wouldn't use it.
  2. No, you are on your own.
  3. In the future strings and seqs should use a shared heap and be `gcsafe` 
out of the box.
  4. I'm not aware of any such article, but here is a hint, I would code it as:


    
    
    import os
    import posix_utils
    import strformat
    import threadpool
    
    
    var tempRootPath {.threadvar.}: string
    
    proc xmiFilePath(fileNumber: int, cleaned: bool): string =
      let cleanedSuffix = "_cleaned"
      if tempRootPath.len == 0:
        # I'm assuming here that ``mkdtemp`` uses a lock...
        tempRootPath = mkdtemp("vppdiff")
      return tempRootPath / fmt"xmi{fileNumber}{cleanedSuffix}.xmi"
    
    var fv = spawn xmiFilePath(1, false)
    
    echo ^fv
    
    
    Run

Reply via email to