How to share an appender!string?

Thorsten Sommer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 19 06:33:50 PDT 2016


Dear all,

I am done :) Thanks @Kagamin, @Rene and @rikki for the help.

Short answers:
@Rene: You are right, I missed the starting of that task i.e. 
thread. Used before spawn() where the thread runs directly. But 
spawn() crashes dpaste.pl...

@rikki: Yes, I known what you mentioned ;) I just constructed a 
very simple and short test code on dpaste.pl and not the full 
implementation of your proposal. Just the basic idea, which is 
great. Within my final solution, I still use your advice and 
reject appender but use just a simple data type instead.

@Rene: Thanks for the great idea with the destructor and the 
thread-local data :) I adapted that for my solution. The order of 
the entries does not matter for my case.

@Kagamin: It do not know why it crashes, but where: It comes from 
the spawn() call.


Issue analysis: My main issue was that the main() does not waited 
for the new thread (I used spawn() before I opened this 
discussion). Thus, a simple thread_joinAll(); solved that.

For the archive -- my final solution with comments:
https://dpaste.dzfl.pl/3a34df24ed6c


Best regards,
Thorsten


More information about the Digitalmars-d-learn mailing list