mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-29 22:51:35 +02:00
Added: Try to restart secondary thread in case of stall and addiotional error checks for ifstream in Proc::collect()
This commit is contained in:
parent
832699ffe6
commit
e20258ea9f
@ -541,10 +541,15 @@ namespace Runner {
|
|||||||
void run(const string& box, const bool no_update, const bool force_redraw) {
|
void run(const string& box, const bool no_update, const bool force_redraw) {
|
||||||
atomic_wait_for(active, true, 5000);
|
atomic_wait_for(active, true, 5000);
|
||||||
if (active) {
|
if (active) {
|
||||||
Global::exit_error_msg = "Stall in Runner thread, quitting!";
|
Logger::error("Stall in Runner thread, restarting!");
|
||||||
active = false;
|
active = false;
|
||||||
|
// exit(1);
|
||||||
|
pthread_cancel(Runner::runner_id);
|
||||||
|
if (pthread_create(&Runner::runner_id, NULL, &Runner::_runner, NULL) != 0) {
|
||||||
|
Global::exit_error_msg = "Failed to re-create _runner thread!";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (stopping or Global::resized) return;
|
if (stopping or Global::resized) return;
|
||||||
|
|
||||||
if (box == "overlay") {
|
if (box == "overlay") {
|
||||||
|
@ -1354,7 +1354,7 @@ namespace Proc {
|
|||||||
uid_user.clear();
|
uid_user.clear();
|
||||||
pread.open(Shared::passwd_path);
|
pread.open(Shared::passwd_path);
|
||||||
if (pread.good()) {
|
if (pread.good()) {
|
||||||
while (not pread.eof()) {
|
while (pread.good()) {
|
||||||
getline(pread, r_user, ':');
|
getline(pread, r_user, ':');
|
||||||
pread.ignore(SSmax, ':');
|
pread.ignore(SSmax, ':');
|
||||||
getline(pread, r_uid, ':');
|
getline(pread, r_uid, ':');
|
||||||
@ -1422,7 +1422,7 @@ namespace Proc {
|
|||||||
if (not pread.good()) continue;
|
if (not pread.good()) continue;
|
||||||
string uid;
|
string uid;
|
||||||
string line;
|
string line;
|
||||||
while (not pread.eof()) {
|
while (pread.good()) {
|
||||||
getline(pread, line, ':');
|
getline(pread, line, ':');
|
||||||
if (line == "Uid") {
|
if (line == "Uid") {
|
||||||
pread.ignore();
|
pread.ignore();
|
||||||
@ -1465,9 +1465,9 @@ namespace Proc {
|
|||||||
uint64_t cpu_t = 0;
|
uint64_t cpu_t = 0;
|
||||||
try {
|
try {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while (++x < next_x + offset) pread.ignore(SSmax, ' ');
|
while (pread.good() and ++x < next_x + offset) pread.ignore(SSmax, ' ');
|
||||||
getline(pread, short_str, ' ');
|
|
||||||
if (not pread.good()) break;
|
if (not pread.good()) break;
|
||||||
|
else getline(pread, short_str, ' ');
|
||||||
|
|
||||||
switch (x-offset) {
|
switch (x-offset) {
|
||||||
case 3: //? Process state
|
case 3: //? Process state
|
||||||
|
Loading…
Reference in New Issue
Block a user