[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua thread newbie
- From: Diego Nehab <diego@...>
- Date: Mon, 22 Aug 2005 11:33:04 -0400 (EDT)
What is Ron fix?
My luathread.c is just same as the one from your site.
if there is any patch, tell me where.
Your example works here, that's why I am asking. But it doesn't work
with Ron's fix. Will look more into it.
b. luasocket does not work under multi threading.
This is true of some functions. As a rule of thumb, any function that
does domain name resolution should be protected by a mutex. That
includes the connect function used by http.request. It also includes
toip, tohostname, getpeername, getsockname etc. Also, you should have
just on thread doing I/O on each socket object.
Maybe this is the cause.
But, this is too big issue.
Multi threading http/ftp... stuff would be very desired feature.
For functions that have thread-safe versions in your system, you can
replace the ones used by LuaSocket with the thread-safe ones (man
gethostbyname_r and see what happens). For those that don't, you have to
use a global mutex and lock/unlock around it.
Let me know what you find out.