Skip to content

Commit d7c34ba

Browse files
committed
MINOR: debug: make ha_thread_dump_done() take the pointer to be used
This will allow the caller to decide whether to definitely clear the pointer and release the thread, or to leave it unlocked so that it's easy to analyse from the struct (the goal will be to use that in panic() so that cores are easy to analyse).
1 parent 091de0f commit d7c34ba

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/debug.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,10 @@ struct buffer *ha_thread_dump_fill(struct buffer *buf, int thr)
395395
return (struct buffer *)((ulong)old & ~0x1UL);
396396
}
397397

398-
/* Indicates to the called thread that the dumped data are collected. It waits
399-
* for the dump to be completed if it was not the case, and can also leave if
400-
* the pointer is NULL (e.g. if a thread has aborted).
398+
/* Indicates to the called thread that the dumped data are collected by writing
399+
* <buf> into the designated thread's dump buffer (usually buf is NULL). It
400+
* waits for the dump to be completed if it was not the case, and can also
401+
* leave if the pointer is NULL (e.g. if a thread has aborted).
401402
*/
402403
void ha_thread_dump_done(struct buffer *buf, int thr)
403404
{
@@ -412,7 +413,7 @@ void ha_thread_dump_done(struct buffer *buf, int thr)
412413
ha_thread_relax();
413414
continue;
414415
}
415-
} while (!HA_ATOMIC_CAS(&ha_thread_ctx[thr].thread_dump_buffer, &old, 0));
416+
} while (!HA_ATOMIC_CAS(&ha_thread_ctx[thr].thread_dump_buffer, &old, buf));
416417
}
417418

418419
/* performs a complete thread dump: calls the remote thread and marks the
@@ -421,7 +422,7 @@ void ha_thread_dump_done(struct buffer *buf, int thr)
421422
void ha_thread_dump(struct buffer *buf, int thr)
422423
{
423424
ha_thread_dump_fill(buf, thr);
424-
ha_thread_dump_done(buf, thr);
425+
ha_thread_dump_done(NULL, thr);
425426
}
426427

427428
/* dumps into the buffer some information related to task <task> (which may

0 commit comments

Comments
 (0)