forked from owent/libcopp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,391 additions
and
700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
|
||
# generated docs | ||
doc/doxygen/* | ||
docs/doxygen/* | ||
|
||
# IDE & Editors | ||
/.vscode | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DEVELOPER | ||
========= | ||
|
||
[basic coroutine object summary](docs/basic_coroutine_class.txt) | ||
|
||
[safe coroutine object summary](docs/safe_basic_coroutine_class.txt) | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#ifndef _COPP_STACKCONTEXT_ALLOCATOR_POOL_H_ | ||
#define _COPP_STACKCONTEXT_ALLOCATOR_POOL_H_ | ||
|
||
#pragma once | ||
|
||
#include <assert.h> | ||
#include <cstddef> | ||
|
||
#include <libcopp/utils/features.h> | ||
#include <libcopp/utils/std/smart_ptr.h> | ||
|
||
#ifdef COPP_HAS_ABI_HEADERS | ||
#include COPP_ABI_PREFIX | ||
#endif | ||
|
||
namespace copp { | ||
struct stack_context; | ||
|
||
namespace allocator { | ||
|
||
/** | ||
* @brief memory allocator | ||
* this allocator will maintain buffer using malloc/free function | ||
*/ | ||
template <typename TPool> | ||
class stack_allocator_pool { | ||
public: | ||
typedef TPool pool_t; | ||
|
||
public: | ||
stack_allocator_pool() UTIL_CONFIG_NOEXCEPT {} | ||
~stack_allocator_pool() {} | ||
|
||
/** | ||
* specify memory section allocated | ||
* @param start_ptr buffer start address | ||
* @param max_size buffer size | ||
* @note must be called before allocate operation | ||
*/ | ||
void attach(const std::shared_ptr<pool_t> &p) UTIL_CONFIG_NOEXCEPT { pool_ = p; } | ||
|
||
/** | ||
* allocate memory and attach to stack context [standard function] | ||
* @param ctx stack context | ||
* @param size ignored | ||
* @note size must less or equal than attached | ||
*/ | ||
void allocate(stack_context &ctx, std::size_t size) UTIL_CONFIG_NOEXCEPT { | ||
assert(pool_); | ||
if (pool_) { | ||
pool_->allocate(ctx); | ||
} | ||
} | ||
|
||
/** | ||
* deallocate memory from stack context [standard function] | ||
* @param ctx stack context | ||
*/ | ||
void deallocate(stack_context &ctx) UTIL_CONFIG_NOEXCEPT { | ||
assert(pool_); | ||
if (pool_) { | ||
pool_->deallocate(ctx); | ||
} | ||
} | ||
|
||
private: | ||
std::shared_ptr<pool_t> pool_; | ||
}; | ||
} | ||
} | ||
|
||
#ifdef COPP_HAS_ABI_HEADERS | ||
#include COPP_ABI_SUFFIX | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
include/libcopp/stack/allocator/stack_allocator_split_segment.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.