1 // Created on: 2015-05-28
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 #ifndef _BVH_BuildQueue_Header
17 #define _BVH_BuildQueue_Header
19 #include <BVH_Builder.hxx>
21 #include <Standard_Mutex.hxx>
22 #include <NCollection_Sequence.hxx>
24 //! Command-queue for parallel building of BVH nodes.
27 template <class T, int N> friend class BVH_QueueBuilder;
31 //! Creates new BVH build queue.
38 //! Releases resources of BVH build queue.
46 //! Returns current size of BVH build queue.
47 Standard_EXPORT Standard_Integer Size();
49 //! Enqueues new work-item onto BVH build queue.
50 Standard_EXPORT void Enqueue (const Standard_Integer& theNode);
52 //! Fetches first work-item from BVH build queue.
53 Standard_EXPORT Standard_Integer Fetch (Standard_Boolean& wasBusy);
55 //! Checks if there are active build threads.
56 Standard_Boolean HasBusyThreads()
58 return myNbThreads != 0;
63 //! Queue of BVH nodes to build.
64 NCollection_Sequence<Standard_Integer> myQueue;
68 //! Manages access serialization of working threads.
69 Standard_Mutex myMutex;
71 //! Number of active build threads.
72 Standard_Integer myNbThreads;
75 #endif // _BVH_BuildQueue_Header