Python Forum
using locks in multithreading in python3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using locks in multithreading in python3
#3
Hi,

couple of remarks on the code:
  • Don't use global. In 99% of all cases it's a clear indication that the design pattern of your code is not good. global can be avoided in most cases.
  • In case you need a lock within your class, make it an attribute of you class.
  • The lock doesn't make sense here anyway at all, as there is no concurrent operation on anything.
  • Your are using a very old school way of string formating... Use the string's format() method or for Python >= 3.6 f-strings.

Regards, noisefloor
Reply


Messages In This Thread
using locks in multithreading in python3 - by srm - Jul-13-2019, 07:08 AM
RE: using locks in multithreading in python3 - by noisefloor - Jul-13-2019, 11:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  multithreading Hanyx 4 1,319 Jul-29-2022, 07:28 AM
Last Post: Larz60+
Question Problems with variables in multithreading Wombaz 2 1,320 Mar-08-2022, 03:32 PM
Last Post: Wombaz
  Multithreading question amadeok 0 1,772 Oct-17-2020, 12:54 PM
Last Post: amadeok
  How can i add multithreading in this example WoodyWoodpecker1 3 2,503 Aug-11-2020, 05:30 PM
Last Post: deanhystad
  matplotlib multithreading catosp 0 2,943 Jul-03-2020, 09:33 AM
Last Post: catosp
  Multithreading dynamically syncronism Rodrigo 0 1,528 Nov-08-2019, 02:33 AM
Last Post: Rodrigo
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 4,892 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Locks in Multithreading Chuonon 0 1,836 Oct-03-2019, 04:16 PM
Last Post: Chuonon
  multithreading issue with output mr_byte31 4 3,193 Sep-11-2019, 12:04 PM
Last Post: stullis
  Multithreading alternative MartinV279 1 2,776 Aug-01-2019, 11:41 PM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020