Skip to content

Commit

Permalink
change method name
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Feb 11, 2024
1 parent c7e9edd commit 130ee62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int main()
return 1 ;
}

if(!tray.update_parallel()) {
if(!tray.update_with_loop()) {
return 1 ;
}

Expand Down
13 changes: 6 additions & 7 deletions include/fluent_tray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,11 @@ namespace fluent_tray
}

bool update() {
if(status_ == TrayStatus::FAILED) {
status_ = TrayStatus::STOPPED ;
return false ;
}

MSG msg ;
get_message(msg) ;

Expand Down Expand Up @@ -671,27 +676,21 @@ namespace fluent_tray
return true ;
}

bool update_parallel(
bool update_with_loop(
std::chrono::milliseconds sleep_time=std::chrono::milliseconds(1)) {

// TODO: launch async
while(true) {
if(status_ == TrayStatus::SHOULD_STOP) {
status_ = TrayStatus::STOPPED ;
break ;
}
if(status_ == TrayStatus::FAILED) {
status_ = TrayStatus::STOPPED ;
return false ;
}

if(!update()) {
return false ;
}

Sleep(static_cast<int>(sleep_time.count())) ;
}

return true ;
}

Expand Down

0 comments on commit 130ee62

Please sign in to comment.