From 81a1fd47447714ed4cb28d0b47644866c40754d7 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 19 May 2018 21:10:34 +0900 Subject: [PATCH] testflock: Use just sync.Mutex on browsers (#615) --- internal/testflock/flock_js.go | 31 +++++++++++++++++++ .../testflock/{flock.go => flock_notjs.go} | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 internal/testflock/flock_js.go rename internal/testflock/{flock.go => flock_notjs.go} (98%) diff --git a/internal/testflock/flock_js.go b/internal/testflock/flock_js.go new file mode 100644 index 000000000..78e77285b --- /dev/null +++ b/internal/testflock/flock_js.go @@ -0,0 +1,31 @@ +// Copyright 2018 The Ebiten Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build js + +package testflock + +import ( + "sync" +) + +var theLock sync.Mutex + +func Lock() { + theLock.Lock() +} + +func Unlock() { + theLock.Unlock() +} diff --git a/internal/testflock/flock.go b/internal/testflock/flock_notjs.go similarity index 98% rename from internal/testflock/flock.go rename to internal/testflock/flock_notjs.go index 6b0c18aa6..b7a4c0617 100644 --- a/internal/testflock/flock.go +++ b/internal/testflock/flock_notjs.go @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build !js + // Package testflock provides a lock for testing. // // There is a CI service like TravisCI where multiple OpenGL processes