Replace RLock by Semaphore

This commit is contained in:
Yohann D'ANELLO 2021-01-09 21:45:50 +01:00
parent 4b9d3501a1
commit 414173c0eb
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 3 additions and 4 deletions

View File

@ -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()