-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix ExpireContainer<T> insert should protect by lock * `RingChannel` now will busy yield for a while before waiting in semaphore, to improve performance * `Executor`, `WorkPool` now use `RingChannel` for async task delivery * Fix libaio may lost requests if `io_submit` failed * Improve metric-meter accuracy * http `URL` provides `host_no_port()` * `set_photon_thread_stack_allocator` able to hook photon threads allocation, helps with GC adaption * `client_function_test` should not initial et_poller if arch is not linux * FIX `set_photon_thread_stack_allocator` implemention --------- Signed-off-by: Coldwings <coldwings@me.com>
- Loading branch information
Showing
19 changed files
with
245 additions
and
115 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
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,37 @@ | ||
#include <gtest/gtest.h> | ||
#include <photon/common/executor/executor.h> | ||
#include <photon/common/utility.h> | ||
#include <photon/common/alog.h> | ||
#include <photon/photon.h> | ||
#include <photon/thread/thread.h> | ||
|
||
#include <thread> | ||
|
||
TEST(enter_as_executor, test) { | ||
// set global default logger output to null | ||
set_log_output(log_output_null); | ||
|
||
// create own logger | ||
ALogLogger logger; | ||
// set log_output to stdout, log level as info | ||
logger.log_output = log_output_stdout; | ||
logger.log_level = ALOG_INFO; | ||
|
||
photon::init(); | ||
DEFER(photon::fini()); | ||
// do some ready work in this photon environment | ||
auto vcpu = photon::get_vcpu(); | ||
auto e = photon::Executor::export_as_executor(); | ||
DEFER(delete e); | ||
|
||
std::thread([&logger, e, vcpu] { | ||
e->perform([&logger, vcpu] { | ||
logger << LOG_INFO("Hello from a normal thread"); | ||
auto cvcpu = photon::get_vcpu(); | ||
logger << LOG_INFO("executor at `, current on `, `", vcpu, cvcpu, | ||
vcpu == cvcpu ? "EQ" : "NEQ"); | ||
}); | ||
}).detach(); | ||
|
||
photon::thread_usleep(1UL * 1024 * 1024); | ||
} |
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.