You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are so many issues in this code, I am shocked!
First of all, the LICENSE file states out that the given project is licensed under the GNU General Public License v3.0 while the readme.md says it is licensed under
the MIT license?
Now, the code itself is full of issues:
PEP8: The code clearly breaks the style convention specified by PEP8
inline imports of multiple packages
unused import multiprocessing
missing 2 empty lines between functions and classes
This code is not thread safe as the Lock is created within that method, which means that different threads will create
different Lock instances, making this line of code completely useless. Better would be:
# global variablelock=threading.Lock()
defsafe_print() ->None:
withlock:
print("hi")
look at target! You are calling run instead of passing the method itself to target. That means that you execute the method in the current thread instead of the new thread that you are trying to create there, essentially blocking the while loop and hence blocking the creation of new threads.
The text was updated successfully, but these errors were encountered:
There are so many issues in this code, I am shocked!
First of all, the
LICENSE
file states out that the given project is licensed under theGNU General Public License v3.0 while the
readme.md
says it is licensed underthe MIT license?
Now, the code itself is full of issues:
PEP8
: The code clearly breaks the style convention specified by PEP8multiprocessing
except
clausethreading.Lock
is completely misusedThis code is not thread safe as the
Lock
is created within that method, which means that different threads will createdifferent
Lock
instances, making this line of code completely useless. Better would be:rewrite as:
Files are opened explicitly with the
r
parameter although it is the default parameter valueopen("blah", "r")
==open("blah")
Why so much work?
look at
target
! You are callingrun
instead of passing the method itself totarget
. That means that you execute the method in the current thread instead of the new thread that you are trying to create there, essentially blocking thewhile
loop and hence blocking the creation of new threads.The text was updated successfully, but these errors were encountered: