Discussion Locked

Signals in GTK and Linux

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

I am writing a program which can take input from two seperate windows (although the input from one of the windows is limited to pressing 'ENTER' - they are seperate processes created with the 'fork()' command), and my problem is the following:
The main process can read/write into a file when buttons in the main window are clicked. When the ENTER key is pressed in the other window/process, a change has to be made to the same file. A signal is then sent by the other window to the main window, which will then handle the writing of the file.
The question is now: Since GTK signals are implemented differently from UNIX signals, how will the program react if a button resulting in a write to file in the main window, is pressed AT EXACTLY THE SAME TIME as the ENTER key is pressed in the other window?

3 replies

by awimsatt

It's not possible to click in one window and hit enter in another at the same time... so I think the problem is solved. My guess that if both tried to open the same file you would get an error, but that shouldn't ever happen as long as you make sure to close the file after every writting.

--Adam

by boschke

I beg to differ... There is a small possibility that both events occur at the same time. The reason is that - and I agree that I should have mentioned it - one of the two windows will be run on a remote X host. Therefore it IS possible that the two processes will try to access the file at the same time.

This discussion is closed to new replies.