i’m using push/pop method in different process. when pushing or popping queue, do i need explicitly a lock/unlock for the operation of queue.
is the lock necessary or not?
thanks, everyone!
example as follow:
int que[$];
semaphore lock;
fork
forever begin
some action;
lock.get(1);
que.push_back(item);
lock.put(1);
end
forever begin
some action;
lock.get(1);
que.pop_front(item);
lock.put(1);
end