singlefile icon indicating copy to clipboard operation
singlefile copied to clipboard

proposal: cross-platform solution

Open plutov opened this issue 7 years ago • 1 comments

I found that this pkg has no solution for Windows, but it's not my problem, I just asked myself, why did you use this approach?

I'm not sure in my way, but let me propose it.

  • Define map[string]bool suring pkg's init()
  • Lock adds new element to a map
  • unlock will remove it

Or we can do it without map. Or even with mutex.

If user's code between Lock and Unlock will have a pnic we will lost a lock. And it is good I think.

plutov avatar Mar 23 '17 08:03 plutov

@plutov your approach does not support host-wide locks, which is the problem this package successfully solves.

also, FYI, smallest type in Go is struct{}, not bool.

kirillDanshin avatar Aug 12 '18 16:08 kirillDanshin