P4 to Git Change 1082378 by lmoriche@lmoriche_opencl_dev on 2014/09/29 17:08:11
ECR #304775 - Replace amd::Atomic with std::atomic Pre-checkin: http://ocltc.amd.com:8111/viewModification.html?modId=40639&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#38 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/os_win32.cpp#40 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#64 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#73 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#108 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#86 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/runtime.cpp#33 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/monitor.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/semaphore.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/semaphore.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/util.hpp#10 edit
Esse commit está contido em:
@@ -6,10 +6,11 @@
|
||||
#define MONITOR_HPP_
|
||||
|
||||
#include "top.hpp"
|
||||
#include "atomic.hpp"
|
||||
#include "thread/atomic.hpp"
|
||||
#include "thread/semaphore.hpp"
|
||||
#include "thread/thread.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
@@ -22,9 +23,43 @@ namespace amd {
|
||||
* @{
|
||||
*/
|
||||
|
||||
namespace details {
|
||||
|
||||
template <class T, class AllocClass = HeapObject>
|
||||
struct SimplyLinkedNode : public AllocClass
|
||||
{
|
||||
typedef SimplyLinkedNode<T, AllocClass> Node;
|
||||
|
||||
protected:
|
||||
std::atomic<Node*> next_; /*!< \brief The next element. */
|
||||
T volatile item_;
|
||||
|
||||
public:
|
||||
//! \brief Return the next element in the linked-list.
|
||||
Node* next() const { return next_; }
|
||||
//! \brief Return the item.
|
||||
T item() const { return item_; }
|
||||
|
||||
//! \brief Set the next element pointer.
|
||||
void setNext(Node* next) { next_ = next; }
|
||||
//! \brief Set the item.
|
||||
void setItem(T item) { item_ = item; }
|
||||
|
||||
//! \brief Swap the next element pointer.
|
||||
Node* swapNext(Node* next) { return next_.swap(next); }
|
||||
|
||||
//! \brief Compare and set the next element pointer.
|
||||
bool compareAndSetNext(Node* compare, Node* next)
|
||||
{
|
||||
return next_.compare_exchange_strong(compare, next);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
|
||||
class Monitor : public HeapObject
|
||||
{
|
||||
typedef SimplyLinkedNode<Semaphore*,StackObject> LinkedNode;
|
||||
typedef details::SimplyLinkedNode<Semaphore*,StackObject> LinkedNode;
|
||||
|
||||
private:
|
||||
static const bool kUnlocked = false;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário