diff options
author | wm4 <wm4@nowhere> | 2013-12-22 12:29:16 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-22 12:29:50 +0100 |
commit | 38be9d5fed172ab8ee24c8c2cb0c94fb41d02e37 (patch) | |
tree | e28d65be9938ba0befadc36b38ea9448adfec765 /common/msg.c | |
parent | a0e89daf49d429d05b1a87886f0f834648a2ff36 (diff) | |
download | mpv-38be9d5fed172ab8ee24c8c2cb0c94fb41d02e37.tar.bz2 mpv-38be9d5fed172ab8ee24c8c2cb0c94fb41d02e37.tar.xz |
msg: add some comments about thread-safety
Diffstat (limited to 'common/msg.c')
-rw-r--r-- | common/msg.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/msg.c b/common/msg.c index ff3071a92c..841fab30c7 100644 --- a/common/msg.c +++ b/common/msg.c @@ -101,6 +101,7 @@ static void update_loglevel(struct mp_log *log) } // Return whether the message at this verbosity level would be actually printed. +// Thread-safety: see mp_msg(). bool mp_msg_test(struct mp_log *log, int lev) { mp_memory_barrier(); @@ -173,6 +174,8 @@ void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va) // parent's name. If the name starts with "/", the parent's name is not // prefixed (except in verbose mode), and if it starts with "!", the name is // not printed at all (except in verbose mode). +// Thread-safety: fully thread-safe, but keep in mind that talloc is not (so +// talloc_ctx must be owned by the current thread). struct mp_log *mp_log_new(void *talloc_ctx, struct mp_log *parent, const char *name) { @@ -262,6 +265,9 @@ void mp_msg_uninit(struct mpv_global *global) global->log = NULL; } +// Thread-safety: fully thread-safe, but keep in mind that the lifetime of +// log must be guaranteed during the call. +// Never call this from signal handlers. void mp_msg(struct mp_log *log, int lev, const char *format, ...) { va_list va; |