Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #3429
| From | Stephen Heumann <stephen.heumann@gmail.com> |
|---|---|
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Calling Marinetti from an init |
| Date | 2017-04-20 22:53 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <odbvhn$d7m$1@dont-email.me> (permalink) |
I'm working on a IIgs system extension (an init) that uses TCP/IP. I would like it to be able to continually poll for incoming data and send responses as long as GS/OS is running (regardless of the current application), but I don't see an entirely satisfactory way to do that. The basic issue is that it doesn't seem to be safe to call Marinetti using interrupt-based timers (e.g. from a heartbeat task). This may appear to work as long as nothing else is using Marinetti, but if something else is, then I get dropped connections and other odd behavior. I think this is because my code may wind up calling Marinetti while the other program is also in the middle of a Marinetti call, and since Marinetti is not (fully) reentrant this corrupts its state. My understanding is that it's generally safe to make most tool calls in such situations if the system busy flag is not set (and if it is set then the scheduler can be used to defer the operation until it's not), but this doesn't seem to make a difference with Marinetti. As far as I can tell from looking at the MOSP code, Marinetti never increments the busy flag, so it's not surprising that this doesn't work. My current workaround for this issue is to use a run queue task instead. This more or less works in desktop programs, but it doesn't work in other environments like textual shells, because they don't call SystemTask and therefore run queue tasks don't get run. (There can also be an issue if a desktop program is busy with something and doesn't call SystemTask for a long time.) Am I missing some good way to do what I want? If not, should Marinetti be changed to make this possible? I think at a minimum it would have to be modified to increment the busy flag around any non-reentrant sections of code. It seems like this would be useful for a fairly wide range of programs, including servers and programs that provide some kind of system service using a TCP/IP connection. -- Stephen Heumann
Back to comp.sys.apple2.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Calling Marinetti from an init Stephen Heumann <stephen.heumann@gmail.com> - 2017-04-20 22:53 -0500
Re: Calling Marinetti from an init andrew.roughan@writeme.com - 2017-05-02 16:58 -0700
Re: Calling Marinetti from an init andrew.roughan@writeme.com - 2017-05-02 17:03 -0700
Re: Calling Marinetti from an init Stephen Heumann <stephen.heumann@gmail.com> - 2017-05-02 21:13 -0500
csiph-web