mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add rb_th_serial()
`rb_th_serial(th)` returns th's serial for debug print purpose.
This commit is contained in:
parent
d9984f39d3
commit
f3235ac095
Notes:
git
2022-05-24 10:07:23 +09:00
2 changed files with 7 additions and 1 deletions
2
debug.c
2
debug.c
|
|
@ -474,7 +474,7 @@ ruby_debug_log(const char *file, int line, const char *func_name, const char *fm
|
|||
// thread information
|
||||
const rb_thread_t *th = GET_THREAD();
|
||||
if (r && len < MAX_DEBUG_LOG_MESSAGE_LEN) {
|
||||
r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\tth:%u", (unsigned int)th->serial);
|
||||
r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\tth:%u", rb_th_serial(th));
|
||||
if (r < 0) rb_bug("ruby_debug_log returns %d\n", r);
|
||||
len += r;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1078,6 +1078,12 @@ typedef struct rb_thread_struct {
|
|||
#endif
|
||||
} rb_thread_t;
|
||||
|
||||
static inline unsigned int
|
||||
rb_th_serial(const rb_thread_t *th)
|
||||
{
|
||||
return (unsigned int)th->serial;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
VM_DEFINECLASS_TYPE_CLASS = 0x00,
|
||||
VM_DEFINECLASS_TYPE_SINGLETON_CLASS = 0x01,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue