{"action":"closed","issue":{"url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5077","repository_url":"https://api.github.com/repos/PowerShell/PowerShell","labels_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5077/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5077/comments","events_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/5077/events","html_url":"https://github.com/PowerShell/PowerShell/issues/5077","id":264108225,"number":5077,"title":"can not create mutex,why?","user":{"login":"chuanjiao10","id":8968667,"avatar_url":"https://avatars0.githubusercontent.com/u/8968667?v=4","gravatar_id":"","url":"https://api.github.com/users/chuanjiao10","html_url":"https://github.com/chuanjiao10","followers_url":"https://api.github.com/users/chuanjiao10/followers","following_url":"https://api.github.com/users/chuanjiao10/following{/other_user}","gists_url":"https://api.github.com/users/chuanjiao10/gists{/gist_id}","starred_url":"https://api.github.com/users/chuanjiao10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuanjiao10/subscriptions","organizations_url":"https://api.github.com/users/chuanjiao10/orgs","repos_url":"https://api.github.com/users/chuanjiao10/repos","events_url":"https://api.github.com/users/chuanjiao10/events{/privacy}","received_events_url":"https://api.github.com/users/chuanjiao10/received_events","type":"User","site_admin":false},"labels":[{"id":311043053,"url":"https://api.github.com/repos/PowerShell/PowerShell/labels/Issue-Question","name":"Issue-Question","color":"fc2929","default":false},{"id":423531321,"url":"https://api.github.com/repos/PowerShell/PowerShell/labels/Resolution-Answered","name":"Resolution-Answered","color":"ffffff","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-10-10T06:02:59Z","updated_at":"2017-10-10T13:44:04Z","closed_at":"2017-10-10T13:44:04Z","author_association":"NONE","body":"In linux,i want create a mutex use my old script,just as in windows.\r\nBut $mutex_created allways return $true,\r\nwhy? where is problem? myself or powershell or .net? please help to see.\r\n\r\nreference:\r\nhttps://docs.microsoft.com/en-us/dotnet/api/system.threading.mutex.-ctor?view=netstandard-2.0\r\n\r\n\r\n\r\n\r\nSteps to reproduce \r\n------------------\r\nin two bash termal run:\r\npowershell -file /powershell/my_mutex.ps1\r\nthen two powershell process.\r\n\r\n```\r\n$mutexname = 'abcd'\r\n$mutex_created = $flase\r\n$mutex_object = New-Object System.Threading.Mutex ($true,$mutexname,[ref]$mutex_created)\r\nif ($mutex_created)\r\n{\r\n\twrite-host '互斥成功，开始干活!'\r\n\tstart-sleep  -Seconds 60 #你的任务\r\n\t$mutex_object.ReleaseMutex() | Out-Null\r\n\t$mutex_object.Dispose() | Out-Null\r\n\twrite-host '互斥结束，释放'\r\n}\r\nelse\r\n{\r\n\twrite-host '互斥失败 !'\r\n}\r\n```\r\n\r\n\r\n\r\n\r\nActual behavior\r\n------------------\r\nwindows 10 14393 + powershell 5.1:\r\nnormal \r\n\r\n\r\ncentos 7.4 + powershell 6.0 beta8: \r\nNo error, $mutex_created allways $true.\r\n\r\n"}}
{"actor":{"display_login":"markekraus"}}