This question was closed as non-working code, in spite of the following, from the OP:
THe [sic] problem is that this implementation makes the CPU of the machine where the service app is running go to 100% and freeze the complete system untill [sic] the service is killed.
Closing the question seemed to be the right call, and it was closed by community members with closing privilege, without moderator intervention.
A user made the following comment:
@Mat'sMug, the code is working, but it's just slow with a CPU overhead. So it's time to make a review... I would say it depends on your point of view. For me this is a valid question.
Was closing that question the right thing to do?