Example #1
0
 // pop uri from the queue
 MyUri DequeueUri()
 {
     Monitor.Enter(queueURLS);
     MyUri uri = null;
     try
     {
         uri = (MyUri)queueURLS.Dequeue();
     }
     catch (Exception)
     {
     }
     Monitor.Exit(queueURLS);
     return uri;
 }
Example #2
0
        // push uri to the queue
        bool EnqueueUri(MyUri uri, bool bCheckRepetition)
        {
            // add the uri to the binary tree to check if it is duplicated or not
            if (bCheckRepetition == true)
                return false;

            Monitor.Enter(queueURLS);
            try
            {
                // add the uri to the queue
                queueURLS.Enqueue(uri);
            }
            catch (Exception)
            {
            }
            Monitor.Exit(queueURLS);

            return true;
        }