MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / getDefault

Method getDefault

include/internal/CL/cl.hpp:5597–5656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5595#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
5596
5597 static CommandQueue getDefault(cl_int * err = NULL)
5598 {
5599 int state = detail::compare_exchange(
5600 &default_initialized_,
5601 __DEFAULT_BEING_INITIALIZED, __DEFAULT_NOT_INITIALIZED);
5602
5603 if (state & __DEFAULT_INITIALIZED) {
5604 if (err != NULL) {
5605 *err = default_error_;
5606 }
5607 return default_;
5608 }
5609
5610 if (state & __DEFAULT_BEING_INITIALIZED) {
5611 // Assume writes will propagate eventually...
5612 while(default_initialized_ != __DEFAULT_INITIALIZED) {
5613 detail::fence();
5614 }
5615
5616 if (err != NULL) {
5617 *err = default_error_;
5618 }
5619 return default_;
5620 }
5621
5622 cl_int error;
5623
5624 Context context = Context::getDefault(&error);
5625 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5626
5627 if (error != CL_SUCCESS) {
5628 if (err != NULL) {
5629 *err = error;
5630 }
5631 }
5632 else {
5633 Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
5634
5635 default_ = CommandQueue(context, device, 0, &error);
5636
5637 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5638 if (err != NULL) {
5639 *err = error;
5640 }
5641 }
5642
5643 detail::fence();
5644
5645 default_error_ = error;
5646 // Assume writes will propagate eventually...
5647 default_initialized_ = __DEFAULT_INITIALIZED;
5648
5649 detail::fence();
5650
5651 if (err != NULL) {
5652 *err = default_error_;
5653 }
5654 return default_;

Callers

nothing calls this directly

Calls 3

fenceFunction · 0.85
errHandlerFunction · 0.85
CommandQueueClass · 0.85

Tested by

no test coverage detected