HN user

servaldeneptuno

3 karma
Posts1
Comments4
View on HN

As a layman in terms of LLMs and the latest AI developments, the problem you bring up inevitably evokes for me the question of why would we ever want these tools to replace search engines or similar technologies. For me, the beauty of the internet and search engines is that you get 'directions' to a multiplicity of answers instead of a single one that summarizes them for me and implicitly takes all the decision power on what's relevant or accurate from me. Obviously censorship and bias is undeniably a factor for what we have right now. But I think that's a very different problem.

I have an unrelated (and most likely dumb) question about the article. When they talk about the inheritance relationship between 'Thread' and 'MyThread' in the example code in reference to the destructor methods, particularly here:

Now, what happens when MyThread::singlepassThreadWork() uses a member variable of MyThread like foobar and we delete the MyThread object while the thread is still running? The destruction sequence is such that MyThread is deleted first and after that, the destructor of its parent object Thread runs and the thread is joined. Thus, there is a race condition: We risk accessing the vector foobar in singlepassThreadWork() after it was already deleted. We can fix the user code by explicitly stopping the thread in its destructor

What does it mean when they say 'the destructor of its *parent* object Thread runs'? I've always thought that when you inherit from one class to another and then instantiate an object of said class, they're just one object, so what do they mean when they make the distinction between 'parent' and 'child' object? When you have inheritance of say two classes, those would be two distinct objects instantiated in memory? Is there something I'm missing?