Re: wxAppConsole and fork
Vadim Zeitlin <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 21 Jun 2024 23:21:17 -0700 (PDT) Сергей Коныгин wrote:
> I'm writing a simple linux daemon using wxAppConsole. Linux daemons usually
> use fork function for creating a child process. Can I use fork in OnInit()
> function? Is there an another way to create the child process and exit?
You should be able to use fork(), after all wxExecute() does it (see its
code in src/unix/utilsunx.cpp) and using it in OnInit() works fine, AFAIK.
Or you could also use wxIMPLEMENT_APP_NO_MAIN() and provide your own
main() which would fork first, before calling wxEntry() from the branch
which needs to use wx. Read the documentation of wxDISABLE_DEBUG_SUPPORT()
macro if you do this.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/
signature.asc
(application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZnbbAwAKCRAG6kHeT2we hpPsAKCTo/h0XKO8Gk47bJQjoJtAIWUtYQCglyQVOr/GIdMTa+f5vfXO0bBX5vE= =/SMz -----END PGP SIGNATURE-----