Re: Re: [Prothon-commits] rev 149 - in trunk:include/prothon src
"Mark Hahn" <[email protected]> Sat, 27 Mar 2004 20:21:18 -0800
| Newsgroups | gmane.comp.lang.prothon.devel |
|---|---|
| Message-ID | <030501c4147c$2167d690$d701a8c0@MarkVaio> |
Are you talking about this line? pr_lock(&thread_registry_lock); pr_unlock(&thread_registry_lock); I unlock it on the same line. I guess this is a good argument for never putting two statements on the same line. ----- Original Message ----- From: "Ben Collins" <[email protected]> To: "Mark Hahn" <[email protected]> Cc: <[email protected]> Sent: Saturday, March 27, 2004 7:40 PM Subject: Re: [Prothon-dev] Re: [Prothon-commits] rev 149 - in trunk:include/prothon src > > > + if (main_argv_obj && list_len(ist, main_argv_obj)) { > > > + new_thread_obj((apr_thread_start_t)main_thread, main_argv_obj); > > > + /* Grab this lock, so we know main1 thread has started */ > > > + pr_lock(&thread_registry_lock); pr_unlock(&thread_registry_lock); > > > > > > + } > > > + > > > threads = get_attr(ist, sys_argv_obj, sym(ist, "threads")); > > > if (threads) { > > > int i; > > > for (i = 0; i < list_len(ist, threads); i++) > > > - start_new_thread((apr_thread_start_t)main_thread, list_item(ist, > > threads, i)); > > > + new_thread_obj((apr_thread_start_t)main_thread, list_item(ist, > > threads, i)); > > > } > > After you create the first new_thread_obk() for main args, you grab the > lock to make sure it completes startup. However you never release it > before calling new_thread_obj() again for the -t options. So the first > time you call new_thread_obj() for one, it will deadlock waiting for > thread_registry_lock to be released. > > You should only grab that lock once you have started all the threads you > want to, and then release it. > > -- > Debian - http://www.debian.org/ > Linux 1394 - http://www.linux1394.org/ > Subversion - http://subversion.tigris.org/ > WatchGuard - http://www.watchguard.com/ > > >