Answer the question
In order to leave comments, you need to log in
How to organize version control?
Hello!
Not long ago, this question appeared :
Let's say I have a web application in PHP. But, every time it is added and expanded, I add functions, improve something, remove something. The web application is already running in two organizations. And they are different, since one of the organizations asks to add reports, respectively, the files began to differ.
How to organize the application so that it itself controls the versions of files, and if at least one file is different, so that it warns. Just the other day I downloaded a newer file automatically and there were problems.
I want my application to be in control of the versions of its files.
Tell me where and what to read, what to watch or how you solved this problem.
Answer the question
In order to leave comments, you need to log in
Firstly, global deque
this is not about multithreading, but about the visibility of variables.
Secondly, the error is actually in this part of the code:
if r not in deque:
deque.append(r);
import threading;
import random;
import collections;
from time import sleep
NUM_THREADS = 50;
COUNT_FOR_EACH_THREAD = 10;
threads = [];
deque = collections.deque();
def threadProc():
for i in range(0, COUNT_FOR_EACH_THREAD):
r = random.randint(0, 100);
if r not in deque:
sleep(0.01)
deque.append(r);
for i in range(0, NUM_THREADS):
thread = threading.Thread(target = threadProc);
threads.append(thread);
thread.start();
for i in range(0, NUM_THREADS):
threads[i].join();
print(deque);
print(len(deque))
print(len(set(deque)))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question