| 89 | } |
| 90 | |
| 91 | int FTPQueue::AddQueueOp(QueueOperation * op) { |
| 92 | op->SetClient(m_wrapper); |
| 93 | |
| 94 | m_monitor->Enter(); |
| 95 | VQueue::iterator it; |
| 96 | for(it = m_queue.begin(); it != m_queue.end(); ++it) { |
| 97 | if (op->Equals(**it)) { |
| 98 | OutMsg("[Queue] The operation was already added to the queue, ignoring"); |
| 99 | m_monitor->Exit(); |
| 100 | return 0; |
| 101 | } |
| 102 | } |
| 103 | m_monitor->Exit(); |
| 104 | |
| 105 | //Can safely inform queueWindow, Add is called by window thread |
| 106 | op->SendNotification(QueueOperation::QueueEventAdd); |
| 107 | |
| 108 | m_monitor->Enter(); |
| 109 | m_queue.push_back(op); |
| 110 | if (m_queue.size() == 1) |
| 111 | m_monitor->Signal(ConditionQueueOps); |
| 112 | m_monitor->Exit(); |
| 113 | |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | int FTPQueue::GetQueueSize() const { |
| 118 | int res = 0; |
no test coverage detected