Bonita Montero <Bonita.Montero@gmail.com>: Feb 08 01:32PM +0100 I've this line in my code: threads.emplace_back( scnThread, shared_ptr<wstring>( new wstring( nextFilePattern ) ), nextPathLength ); Can I rely on that the thread gets its copy of the shared_ptr before all shared_ptr-copies in the initiating thread are desroyed? |
Melzzzzz <Melzzzzz@zzzzz.com>: Feb 08 01:36PM > nextFilePattern ) ), nextPathLength ); > Can I rely on that the thread gets its copy of the shared_ptr > before all shared_ptr-copies in the initiating thread are desroyed? You put object in container. You get object from container in other thread, so shared ptr is still referenced. -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala |
Bonita Montero <Bonita.Montero@gmail.com>: Feb 08 05:01PM +0100 >> Can I rely on that the thread gets its copy of the shared_ptr >> before all shared_ptr-copies in the initiating thread are desroyed? > You put object in container. Which containeer ? > You get object from container in other thread, so shared ptr is still referenced. You don't understand the question. Depending on the implementation it could be like that the local copy of the shared_ptr might get destroyed before the thread get its own copy. But I asked for this on Stack Overflow also and got a more qualfied answer, those I expected: the thread gets safely its own copy and there is no such race-condition. |
Melzzzzz <Melzzzzz@zzzzz.com>: Feb 08 04:08PM >>> before all shared_ptr-copies in the initiating thread are desroyed? >> You put object in container. > Which containeer ? Since you ask this question, I see you are totally clueless. -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala |
Bonita Montero <Bonita.Montero@gmail.com>: Feb 08 06:00PM +0100 >>> You put object in container. >> Which containeer ? > Since you ask this question, I see you are totally clueless. You are clueless - a shared_ptr<> isn't a container. And I guessed the answer, but I wasn't absolutely sure and asked fort certainty. As the question remained here so long without any professional answer I'm not clueless. |
James Kuyper <jameskuyper@alumni.caltech.edu>: Feb 08 09:40AM -0800 On Saturday, February 8, 2020 at 12:01:08 PM UTC-5, Bonita Montero wrote: > >> Which containeer ? > > Since you ask this question, I see you are totally clueless. > You are clueless - a shared_ptr<> isn't a container. He was referring to the container for which you called emplace_back(). You didn't actually tell us it was a container, it could be some user-defined type that just happens to have a member function mis-named emplace_back() - but it's a reasonable guess. > And I guessed the answer, but I wasn't absolutely sure and asked > fort certainty. As the question remained here so long without any > professional answer I'm not clueless. I suspect many people don't bother helping you, who could. |
Bonita Montero <Bonita.Montero@gmail.com>: Feb 08 07:09PM +0100 > He was referring to the container for which you called emplace_back(). You didn't actually tell us it was a container, it could be some user-defined type that just happens to have a member function mis-named emplace_back() - but it's a reasonable guess. That's wasn't part of the problem. |
Tony Mc <afmcc@btinternet.com>: Feb 08 11:34AM > Without that s it makes perfect sense. > Thanks a lot, > Paul It means that "Grail"s is a std::string literal rather than a C-style const char * literal. It comes from the std::string_literals namespace and was introduced with C++14. Tony |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment