URPC server wait defer instead of yield for lower CPU load

This commit is contained in:
Sparchatus 2022-04-28 17:30:41 +00:00
parent 9b29393930
commit d46c7a5875

View File

@ -17,6 +17,7 @@
#include <aos/waitset_chan.h> #include <aos/waitset_chan.h>
#include <aos/aos_rpc.h> #include <aos/aos_rpc.h>
#include <spawn/rpc_server.h> #include <spawn/rpc_server.h>
#include <aos/deferred.h>
extern coreid_t my_core_id; extern coreid_t my_core_id;
extern rpc_handler_t rpc_handlers[RPC_MTYPE_COUNT]; extern rpc_handler_t rpc_handlers[RPC_MTYPE_COUNT];
@ -169,8 +170,8 @@ int urpc_server(void *arg) {
while (true) { while (true) {
// wait until an rpc call arrives // wait until an rpc call arrives
while(urpc->meta->call_in_progress == false) { while(urpc->meta->call_in_progress == false) {
// yield the thread because there might be useful stuff to do... // sleep for a bit while there is nothing to do
thread_yield(); barrelfish_usleep(100);
} }
// memory barrier // memory barrier