Mountain Lion

Martin Naef mnaef at navisto.ch
Sun Feb 19 16:04:34 CET 2012


Hi Peter

On 19.02.2012 13:58, Peter Korsten wrote:
>> The paragraph above pretty much sums it up. Fork is an old concept from
>> the days before multi-threading became the norm, and since multi-tasking
>> is a bit younger in the Windows world compared to Unix, fork was never
>> been considered necessary... CreateThread and CreateProcess are your
>> friends - and then there are of course countless libs to wrap those two
>> nicely.
>
> But in my scenario, where a process detaches itself from the terminal it
> was started from, is it possible to do something similar with Windows?

Yes, there are indeed flags and options to handle terminal windows - 
e.g. creating a new one for the process. You can also just run a "Win32" 
style app that doesn't connect to a terminal at all. I don't remember 
the details from the top of my head as it's been ages since I needed 
something similar.

But if you want a deamon, you should really look into the services concept.

> The impression I get is that you need to add certain flags to the
> CreateProcess call, but that would make the solution actually more
> complex that the Unix one.

It certainly is - but the big question remains why you want this in the 
first place instead of running a multi-threaded app.

Martin




More information about the music-bar mailing list