[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] PyQt5 + Python 3: passing lists, dicts as signal arguments across threads
From:       Mathias.Born () gmx ! de
Date:       2014-09-27 17:41:04
Message-ID: 1722502744.20140927210316 () gmx ! de
[Download RAW message or body]

On 27.09.2014, 23:08:58 Alan Ezust wrote:


> On Thu, Sep 25, 2014 at 1:28 PM, <Mathias.Born@gmx.de> wrote:
> On 25.09.2014, 21:44:15 Alan Ezust wrote:
>> In C++, I pass QList and QMap by value as signal arguments and I
>> know that there will be lazy copy on write, and I can safely use the
>> variables of these types when needed.

> Actually, you cannot.

> cannot pass by value? I don't understand what you mean.

I just wanted to point out, that in C++ you cannot
"safely use the variables of these types when needed."
Not when writing, that is.

> Quoting http://qt-project.org/doc/qt-5/containers.html :

> "In addition, they are thread-safe in situations where they are
> used as read-only containers by all threads used to access them."

> This doesn't come as a surprise, because locking can be very
> expensive.

> My question was about python dict and list though, not about Qt containers.

Since python dicts and lists are converted ("mapped types") and thus copied,
you should be safe. But I'm not entirely sure about this, thus I
kept quiet ...

Best Regards,
Mathias


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic