1 // Created on: 2015-05-27
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2015 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <BVH_BuildQueue.hxx>
18 // =======================================================================
20 // purpose : Returns current size of BVH build queue
21 // =======================================================================
22 Standard_Integer BVH_BuildQueue::Size()
24 Standard_Integer aSize;
28 aSize = myQueue.Size();
35 // =======================================================================
37 // purpose : Enqueues new work-item onto BVH build queue
38 // =======================================================================
39 void BVH_BuildQueue::Enqueue (const Standard_Integer& theWorkItem)
43 myQueue.Append (theWorkItem);
48 // =======================================================================
50 // purpose : Fetches first work-item from BVH build queue
51 // =======================================================================
52 Standard_Integer BVH_BuildQueue::Fetch (Standard_Boolean& wasBusy)
54 Standard_Integer aQuery = -1;
56 Standard_Mutex::Sentry aSentry (myMutex);
58 if (!myQueue.IsEmpty())
60 aQuery = myQueue.First();
62 myQueue.Remove (1); // remove item from queue
77 wasBusy = aQuery != -1;