On Tue, Nov 12, 2013 at 4:29 PM, Marc Balmer <m...@msys.ch> wrote: > Am 12.11.13 17:04, schrieb Christos Zoulas: >> In article <20131112143203.8cd3...@cvs.netbsd.org>, >> Marc Balmer <source-changes-d@NetBSD.org> wrote: >>> -=-=-=-=-=- >>> >>> Module Name: src >>> Committed By: mbalmer >>> Date: Tue Nov 12 14:32:03 UTC 2013 >>> >>> Added Files: >>> src/lib/lua/syslog: Makefile syslog.c >>> >>> Log Message: >>> Add a syslog(3) binding for Lua (not yet linked to the build.) >> >> Is there any reason not to use the modern syslog (thread-safe) functions >> openlog_r(), syslog_r(), syslogp_r()? > > Good question. We would have to keep the context somewhere (certainly > solvable), then, I wonder I Lua is ever used threaded? Could the > problem arise in reality (it did not in our stuff since Jan 1st 2009) > > Maybe if two threads create separate states, and then both threads use > syslog at the same time? (can not happen at this moment).
People do use it threaded sometimes. I would just return a userdata with a _gc method to the user. Justin