ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/GoogleTron.cpp
(Generate patch)

Comparing GoogleTron/GoogleTron.cpp (file contents):
Revision 705 by douglas, 2006-03-18T20:49:26-08:00 vs.
Revision 707 by douglas, 2006-03-18T23:54:29-08:00

# Line 91 | Line 91 | int GoogleTron::Output()
91          writer.SetAttribute(_B("xmlns:xsi"), _B("http://www.w3.org/2001/XMLSchema-instance"));
92          writer.SetAttribute(_B("xsi:schemaLocation"), _B("http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd"));
93  
94 <        do
95 <        {
96 <                Sleep();
97 <
98 <                _synchronized (queueLock)
99 <                        while (queue.GetSize())
94 >        _synchronized (queueLock)
95 >                do
96 >                        _desynchronized (queueLock)
97                          {
98 <                                xml::ScopeElement url_(writer, _B("url"));
99 <                                const Url &url(queue.Front());
98 >                                Sleep();
99 >
100 >                                _synchronized (queueLock)
101 >                                        if (queue.GetSize())
102 >                                        {
103 >                                                xml::ScopeElement url_(writer, _B("url"));
104 >                                                const Url &url(queue.Front());
105  
106 <                                {
107 <                                        xml::ScopeElement loc(writer, _B("loc"));
106 >                                                {
107 >                                                        xml::ScopeElement loc(writer, _B("loc"));
108  
109 <                                        writer.OutputText(url.GetLocation());
110 <                                }
109 >                                                        writer.OutputText(url.GetLocation());
110 >                                                }
111  
112 <                                {
113 <                                        xml::ScopeElement lastmod(writer, _B("lastmod"));
112 >                                                {
113 >                                                        xml::ScopeElement lastmod(writer, _B("lastmod"));
114  
115 <                                        writer.OutputText(url.GetModified());
116 <                                }
115 >                                                        writer.OutputText(url.GetModified());
116 >                                                }
117  
118 <                                {
119 <                                        xml::ScopeElement changefreq(writer, _B("changefreq"));
118 >                                                {
119 >                                                        xml::ScopeElement changefreq(writer, _B("changefreq"));
120  
121 <                                        writer.OutputText(url.GetFrequency());
122 <                                }
121 >                                                        writer.OutputText(url.GetFrequency());
122 >                                                }
123  
124 <                                {
125 <                                        xml::ScopeElement priority(writer, _B("priority"));
124 >                                                {
125 >                                                        xml::ScopeElement priority(writer, _B("priority"));
126  
127 <                                        writer.OutputText(url.GetPriority());
128 <                                }
127 >                                                        writer.OutputText(url.GetPriority());
128 >                                                }
129  
130 <                                queue.Pop();
131 <                
130 <                                _desynchronized (queueLock)
131 <                                        Sleep();
130 >                                                queue.Pop();
131 >                                        }
132                          }
133 <        }
134 <        while (working);
133 >                while (working || queue.GetSize());
134  
135          return 0;
136   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines