Replace RLock by Semaphore
This commit is contained in:
		@@ -4,8 +4,7 @@
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
from random import randint, uniform
 | 
			
		||||
from typing import Any, Tuple, Generator
 | 
			
		||||
# from ipaddress import IPv6Address
 | 
			
		||||
from threading import Thread, RLock
 | 
			
		||||
from threading import Thread, Semaphore
 | 
			
		||||
import curses
 | 
			
		||||
import re
 | 
			
		||||
import socket
 | 
			
		||||
@@ -116,9 +115,9 @@ class User(Peer):
 | 
			
		||||
        self.last_line = -1
 | 
			
		||||
 | 
			
		||||
        # Lock the refresh function in order to avoid concurrent refresh
 | 
			
		||||
        self.refresh_lock = RLock()
 | 
			
		||||
        self.refresh_lock = Semaphore()
 | 
			
		||||
        # Lock functions that can be used by two threads to avoid concurrent writing
 | 
			
		||||
        self.data_lock = RLock()
 | 
			
		||||
        self.data_lock = Semaphore()
 | 
			
		||||
 | 
			
		||||
        self.history = []
 | 
			
		||||
        self.received_messages = dict()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user