lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


D Burgess wrote:

> Can someone with great wisdom either confirm this is OK
> or alternatively tell me what is wrong with this scheme?

It's the "great wisdom" part that is preventing you from getting
answers! Who wants to claim that?

I have always used separate Lua universes in each OS thread and passed
data between them, so even my tiny wisdom isn't enough to reassure you.
But it sounds like you've done the proper thing and the proper analysis,
and the proof is in the pudding - your application runs.

Of course I know where you're coming from. I just found a latent bug in
some of my very old, seemingly very reliable code where I forgot to
initialize a semaphore (pthread mutex/cv combo) that was being used to
synchronize thread destruction for an associated object. The code
ignored the error returned by pthread_wait() so it took a lot longer to
track down than necessary. A new regression test had put the system
under enough stress that the thread and its object were not properly
cleaned up in sync. Segfaults ensued.

The lessons are obvious. Try to have nasty regression tests and make
sure you check all return values, even if it's just to print a message
somewhere about it.

Doug