You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/08/31 07:29:43 UTC

[GitHub] [incubator-mxnet] wkcn commented on a change in pull request #19050: [Infra] add excepthook

wkcn commented on a change in pull request #19050:
URL: https://github.com/apache/incubator-mxnet/pull/19050#discussion_r479947088



##########
File path: python/mxnet/autograd.py
##########
@@ -411,16 +411,14 @@ class _Registry(object):
         """CustomOp registry."""
         def __init__(self):
             self.ref_holder = {}
-            self.counter = 0
-            self.lock = Lock()
+            self.counter = itertools.count()

Review comment:
       There is nothing in the official documentation on itertools say that `itertools.count()` is thread-safe, although `itertools.count()` is thread-safe in CPython 3.8.
   
   https://stackoverflow.com/questions/7083348/is-itertools-thread-safe
   
   I think we can replace it with an integer, which is thread-safe.
   https://stackoverflow.com/questions/6320107/are-python-ints-thread-safe




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org