Hello community,
here is the log from the commit of package golang-org-x-sync for
openSUSE:Factory checked in at 2020-05-16 22:23:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-org-x-sync (Old)
and /work/SRC/openSUSE:Factory/.golang-org-x-sync.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "golang-org-x-sync"
Sat May 16 22:23:14 2020 rev:2 rq:805474 version:0.0.0+git20200317.43a5402
Changes:
--------
--- /work/SRC/openSUSE:Factory/golang-org-x-sync/golang-org-x-sync.changes
2020-01-21 21:00:34.704854913 +0100
+++
/work/SRC/openSUSE:Factory/.golang-org-x-sync.new.2738/golang-org-x-sync.changes
2020-05-16 22:23:20.684904991 +0200
@@ -1,0 +2,17 @@
+Wed May 13 10:11:39 UTC 2020 - John Paul Adrian Glaubitz
<[email protected]>
+
+- Update to version 0.0.0+git20200317.43a5402:
+ * semaphore: unblock waiters when the front waiter cancels
+ * syncmap: use type alias for Map
+ * semaphore: better error message when releasing more than held
+ * singleflight: fix duplicate deleting key when Forget called
+ * all: add a go.mod file
+ * semaphore: add more Acquire documentation
+ * all: remove x/net/context in favour of context
+ * CONTRIBUTING.md: remove note about not accepting Pull Requests
+ * semaphore: add worker-pool example
+ * README: switch to Markdown, add better links
+- Move LICENSE from %doc to %license section
+- Set BuildArch to noarch
+
+-------------------------------------------------------------------
Old:
----
sync-0.0.0+git20190911.cd5d95a.tar.xz
New:
----
_servicedata
sync-0.0.0+git20200317.43a5402.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ golang-org-x-sync.spec ++++++
--- /var/tmp/diff_new_pack.bX3hv1/_old 2020-05-16 22:23:22.236908176 +0200
+++ /var/tmp/diff_new_pack.bX3hv1/_new 2020-05-16 22:23:22.236908176 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package golang
+# spec file for package golang-org-x-sync
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -24,12 +24,12 @@
%global import_path golang.org/x/sync
Name: golang-org-x-%{repo}
-Version: 0.0.0+git20190911.cd5d95a
+Version: 0.0.0+git20200317.43a5402
Release: 0
Summary: Go concurrency primitives
License: BSD-3-Clause
Group: Development/Languages/Golang
-Url: https://%{provider_prefix}
+URL: https://%{provider_prefix}
Source0: %{repo}-%{version}.tar.xz
Source1: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -40,6 +40,8 @@
BuildRequires: golang(golang.org/x/net/context)
Requires: golang(golang.org/x/net/context)
+BuildArch: noarch
+
%{go_nostrip}
%{go_provides}
@@ -61,6 +63,7 @@
%files -f file.lst
%defattr(-,root,root,-)
-%doc README.md LICENSE PATENTS AUTHORS CONTRIBUTORS CONTRIBUTING.md
+%doc README.md PATENTS AUTHORS CONTRIBUTORS CONTRIBUTING.md
+%license LICENSE
%changelog
++++++ _servicedata ++++++
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/golang/sync</param>
<param
name="changesrevision">43a5402ce75a95522677f77c619865d66b8c57ab</param></service></servicedata>++++++
sync-0.0.0+git20190911.cd5d95a.tar.xz -> sync-0.0.0+git20200317.43a5402.tar.xz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/sync-0.0.0+git20190911.cd5d95a/semaphore/semaphore.go
new/sync-0.0.0+git20200317.43a5402/semaphore/semaphore.go
--- old/sync-0.0.0+git20190911.cd5d95a/semaphore/semaphore.go 2019-09-11
20:51:00.000000000 +0200
+++ new/sync-0.0.0+git20200317.43a5402/semaphore/semaphore.go 2020-03-17
02:50:54.000000000 +0100
@@ -67,7 +67,12 @@
// fix up the queue, just pretend we didn't notice the
cancelation.
err = nil
default:
+ isFront := s.waiters.Front() == elem
s.waiters.Remove(elem)
+ // If we're at the front and there're extra tokens
left, notify other waiters.
+ if isFront && s.size > s.cur {
+ s.notifyWaiters()
+ }
}
s.mu.Unlock()
return err
@@ -97,6 +102,11 @@
s.mu.Unlock()
panic("semaphore: released more than held")
}
+ s.notifyWaiters()
+ s.mu.Unlock()
+}
+
+func (s *Weighted) notifyWaiters() {
for {
next := s.waiters.Front()
if next == nil {
@@ -123,5 +133,4 @@
s.waiters.Remove(next)
close(w.ready)
}
- s.mu.Unlock()
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/sync-0.0.0+git20190911.cd5d95a/semaphore/semaphore_test.go
new/sync-0.0.0+git20200317.43a5402/semaphore/semaphore_test.go
--- old/sync-0.0.0+git20190911.cd5d95a/semaphore/semaphore_test.go
2019-09-11 20:51:00.000000000 +0200
+++ new/sync-0.0.0+git20200317.43a5402/semaphore/semaphore_test.go
2020-03-17 02:50:54.000000000 +0100
@@ -169,3 +169,34 @@
sem.Release(n)
wg.Wait()
}
+
+// translated from
https://github.com/zhiqiangxu/util/blob/master/mutex/crwmutex_test.go#L43
+func TestAllocCancelDoesntStarve(t *testing.T) {
+ sem := semaphore.NewWeighted(10)
+
+ // Block off a portion of the semaphore so that Acquire(_, 10) can
eventually succeed.
+ sem.Acquire(context.Background(), 1)
+
+ // In the background, Acquire(_, 10).
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+ go func() {
+ sem.Acquire(ctx, 10)
+ }()
+
+ // Wait until the Acquire(_, 10) call blocks.
+ for sem.TryAcquire(1) {
+ sem.Release(1)
+ runtime.Gosched()
+ }
+
+ // Now try to grab a read lock, and simultaneously unblock the
Acquire(_, 10) call.
+ // Both Acquire calls should unblock and return, in either order.
+ go cancel()
+
+ err := sem.Acquire(context.Background(), 1)
+ if err != nil {
+ t.Fatalf("Acquire(_, 1) failed unexpectedly: %v", err)
+ }
+ sem.Release(1)
+}