-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move BrokenGreenlet to its own file.
- Loading branch information
Showing
10 changed files
with
80 additions
and
83 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
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,45 @@ | ||
/* -*- indent-tabs-mode: nil; tab-width: 4; -*- */ | ||
/** | ||
* Implementation of greenlet::UserGreenlet. | ||
* | ||
* Format with: | ||
* clang-format -i --style=file src/greenlet/greenlet.c | ||
* | ||
* | ||
* Fix missing braces with: | ||
* clang-tidy src/greenlet/greenlet.c -fix -checks="readability-braces-around-statements" | ||
*/ | ||
|
||
#include "greenlet_greenlet.hpp" | ||
|
||
namespace greenlet { | ||
|
||
void* BrokenGreenlet::operator new(size_t UNUSED(count)) | ||
{ | ||
return allocator.allocate(1); | ||
} | ||
|
||
|
||
void BrokenGreenlet::operator delete(void* ptr) | ||
{ | ||
return allocator.deallocate(static_cast<BrokenGreenlet*>(ptr), | ||
1); | ||
} | ||
|
||
greenlet::PythonAllocator<greenlet::BrokenGreenlet> greenlet::BrokenGreenlet::allocator; | ||
|
||
bool | ||
BrokenGreenlet::force_slp_switch_error() const noexcept | ||
{ | ||
return this->_force_slp_switch_error; | ||
} | ||
|
||
UserGreenlet::switchstack_result_t BrokenGreenlet::g_switchstack(void) | ||
{ | ||
if (this->_force_switch_error) { | ||
return switchstack_result_t(-1); | ||
} | ||
return UserGreenlet::g_switchstack(); | ||
} | ||
|
||
}; //namespace greenlet |
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
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
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