added onix fix libs
This commit is contained in:
1 parent
ff5f02bbde
commit
8069cc893f
84 files changed
+78912
No files matched your search
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
|
||||
*
|
||||
* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
|
||||
* and international copyright treaties.
|
||||
*
|
||||
* Access to and use of the software is governed by the terms of the applicable OnixS Software
|
||||
* Services Agreement (the Agreement) and Customer end user license agreements granting
|
||||
* a non-assignable, non-transferable and non-exclusive license to use the software
|
||||
* for it's own data processing purposes under the terms defined in the Agreement.
|
||||
*
|
||||
* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
|
||||
* of this source code or associated reference material to any other location for further reproduction
|
||||
* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
|
||||
*
|
||||
* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
|
||||
* the terms of the Agreement is a violation of copyright law.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined (_WIN32) // The Windows platform.
|
||||
|
||||
#if !defined (STRICT)
|
||||
#define STRICT
|
||||
#endif
|
||||
|
||||
#if !defined (WIN32_LEAN_AND_MEAN)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#else // The Linux platform.
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#endif // The Platform Selector.
|
||||
|
||||
#include <OnixS/FIXEngine/ABI.h>
|
||||
#include <OnixS/FIXEngine/Compiler.h>
|
||||
#include <OnixS/FIXEngine/Definitions.h>
|
||||
|
||||
namespace OnixS {
|
||||
namespace Threading {
|
||||
#if defined (_WIN32)
|
||||
/// Type alias for the thread identifier.
|
||||
typedef DWORD ThreadId;
|
||||
#else
|
||||
/// Type alias for thread identifier.
|
||||
typedef pthread_t ThreadId;
|
||||
#endif
|
||||
|
||||
/// The infinite timeout value.
|
||||
enum { InfiniteTimeout = -1 };
|
||||
|
||||
/// The base class for custom items which can be stored in thread-safe containers.
|
||||
class ONIXS_FIXENGINE_API ItemBase
|
||||
{
|
||||
public:
|
||||
|
||||
/// Initializes the instance.
|
||||
ItemBase() : next_() {}
|
||||
|
||||
/// Destructs the instance.
|
||||
virtual ~ItemBase() ONIXS_FIXENGINE_DEFAULT;
|
||||
|
||||
/// Returns the next item.
|
||||
ItemBase * next() const
|
||||
{
|
||||
return next_;
|
||||
}
|
||||
|
||||
/// Sets the next item.
|
||||
void setNext(ItemBase * nextNode)
|
||||
{
|
||||
next_ = nextNode;
|
||||
}
|
||||
|
||||
/// Performs a required processing of the item.
|
||||
virtual void process() = 0;
|
||||
|
||||
private:
|
||||
|
||||
// The pointer to the next item.
|
||||
ItemBase * volatile next_;
|
||||
};
|
||||
|
||||
typedef PtrTraits<ItemBase>::UniquePtr ItemBaseUniquePtr;
|
||||
|
||||
/// The base class for a custom pool allocator to provide
|
||||
/// a strategy to create/destroy items for the thread-safe pool.
|
||||
class ONIXS_FIXENGINE_API PoolAllocatorBase
|
||||
{
|
||||
public:
|
||||
|
||||
/// Destructs the instance.
|
||||
virtual ~PoolAllocatorBase() ONIXS_FIXENGINE_DEFAULT;
|
||||
|
||||
/// A strategy to create an item.
|
||||
virtual ItemBase * alloc() = 0;
|
||||
|
||||
/// A strategy to destroy an item.
|
||||
virtual void free(ItemBase * element) const
|
||||
{
|
||||
delete element;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user