Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.python Subject: Re: Are threads bad? - was: Future of Pypy? Date: Tue, 24 Feb 2015 15:53:55 -0800 Organization: A noiseless patient Spider Lines: 11 Message-ID: <8761aqamss.fsf@jester.gateway.pace.com> References: <87fv9xdb22.fsf@jester.gateway.pace.com> <54ea7ff4$0$12983$c3e8da3$5496439d@news.astraweb.com> <87zj85bcyu.fsf@jester.gateway.pace.com> <87lhjpb89i.fsf@jester.gateway.pace.com> <87h9udb1eq.fsf@jester.gateway.pace.com> <87bnkkb22u.fsf@jester.gateway.pace.com> <87lhjnang1.fsf@jester.gateway.pace.com> <87bnkjenpp.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="0e072597111c5029870b25b8e5ee5406"; logging-data="1699"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18k+fOd3rTkykLXU4XQqeGy" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:3f6xNqEiF9o9ZRvEWBX2ZOdkcoQ= sha1:9Et88KGpoJqZD3xA89RhjhOQHZ0= Xref: csiph.com comp.lang.python:86362 Marko Rauhamaa writes: > So why lock categorically like that? Java has a handy "synchronized" > keyword that wraps the whole method in "with self.lock". ... > Unfortunately, that deep locking analysis *is* required at every turn, > and mistakes *are* bound to happen. I wonder if synchronized was a mistake in Java. It confused me a lot when I tried to use it, but I never had to mess with it that much. I can't quite tell what your code is doing (why is it attempting a socket read with a lock held) and I'd be interested to see what an STM version would look like.