fpk: crt.readkey problems after fork!!! help! 
Author Message
 fpk: crt.readkey problems after fork!!! help!

I dont think it's a bug.. but it is annoying and strange..

linux ppc386 0.99.14 - I've got a popup menusystem that uses crt.readkey
to read
keypresses. Now, everything works fine.. until I do a fork. The one
branch executes a Halt()
and the other branch captures the returncode with waitpid. Then the f*up
starts.. Readkey doesnt
work as it did before the fork. All characters and escape codes are
echoed on the screen rather than read as keys (^[[A and the like).. and
is only passed to readkey when I press enter.

Now, why would something like this happen? I will greatly appreciate any
ideas anyone has to share.
Coenraad



Wed, 18 Jun 1902 08:00:00 GMT  
 fpk: crt.readkey problems after fork!!! help!

Quote:

> I dont think it's a bug.. but it is annoying and strange..

> linux ppc386 0.99.14 - I've got a popup menusystem that uses crt.readkey
> to read
> keypresses. Now, everything works fine.. until I do a fork. The one
> branch executes a Halt()
> and the other branch captures the returncode with waitpid. Then the f*up
> starts.. Readkey doesnt
> work as it did before the fork. All characters and escape codes are
> echoed on the screen rather than read as keys (^[[A and the like).. and
> is only passed to readkey when I press enter.

> Now, why would something like this happen? I will greatly appreciate any
> ideas anyone has to share.
> Coenraad

When you execute a fork, both processes, the parent and the child share the
open files. This includes stdin, stdout, & stderr.  A halt() executed in
either process will close all the open files. So the file handles that crt
assigned at initialization time are now closed and crt no longer works
correctly. It seems that maybe fork() is not what you really want to be
using.

Cheers!

Ken



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. fpk: crt.readkey problems after fork!!! help!

2. Doing a ReWrite of CRT - a thought on ReadKey

3. FPK/linux crashes on use of CRT unit

4. HELP! -->bugfix crt.tpu tp6 (delay-problem)

5. Problem with Keypressed/Readkey!

6. ReadKey - help

7. I need help with Case Statements and Readkey.

8. BORLAND'S help on ReadKey

9. FPK - Problem with Popen

10. Usage of Fork and other process management functions:

11. crt.zip Replacement CRT units for Turbo/Borland Pascal

12. Q : Help with fpk and blockread

 

 
Powered by phpBB® Forum Software