emresel
Full Member level 5
Hi colleagues;
I want to use a logger lib for my application in C. I found this on github, it seems quite fit my purposes. My question, how can i use it thread-safely?
In my application, i have two threads and both uses logger function (to print a file or stderr). Author gives a function for this purpose -log_set_lock(log_LockFn fn)- but i couldn't figure out how to use it?
https://github.com/rxi/log.c/#log_set_locklog_lockfn-fn
Thanks for help
I want to use a logger lib for my application in C. I found this on github, it seems quite fit my purposes. My question, how can i use it thread-safely?
In my application, i have two threads and both uses logger function (to print a file or stderr). Author gives a function for this purpose -log_set_lock(log_LockFn fn)- but i couldn't figure out how to use it?
https://github.com/rxi/log.c/#log_set_locklog_lockfn-fn
log_set_lock(log_LockFn fn)
If the log will be written to from multiple threads a lock function can be set. The function is passed a udata value (set by log_set_udata()) and the integer 1 if the lock should be acquired or 0 if the lock should be released.
Thanks for help