processes, threads, gtk development, portability on linux and win32

This is a discussion on processes, threads, gtk development, portability on linux and win32 within the C Programming forums, part of the General Programming Boards category; Hello,
I will try to be as clear as possible. I am developing an application under linux using gtk. There ...

processes, threads, gtk development, portability on linux and win32

Hello,

I will try to be as clear as possible. I am developing an application under linux using gtk. There are different gtk programs that can be run standalone. But I want another program to control their switch on/off, ie launch them and kill them at user's request.

1. What would be the "best" way to do so? Using threads or processes?
2. What would be the "best" way to proceed for portability between linux and win32. I read I could use fork and cygwin but I would like to "minimise the dependencies".

Sorry, if there are any mistakes but I am kind of inexperienced in the multithreading programming.

>1. What would be the "best" way to do so? Using threads or processes?
Processes are definitely easier to get right than threads. If you were doing a straight Linux application then I would recommend processes.

>2. What would be the "best" way to proceed for portability between linux and win32.
Linux is inherently process-based while Windows is thread-based. If you want an application that can be more easily ported then you should use concepts that both systems support. In this case, threads. But don't hardcode the (probably pthread) functions and types, use opaque wrappers so that it's easier to replace the Linux specific code with Windows specific code. If you play your cards right, porting could be as easy as the conditional inclusion of a header.