Re: pipes



fjblurt@xxxxxxxxx wrote:
On Aug 29, 12:39 pm, CptDondo <y...@xxxxxxxxxxxxxxxx> wrote:

I only have one process that would write to this area. So if in the
server I set

p[0] = -1;
write ...
p[0] = 0;

then the client would know not to try to read the area until p[0] == 0.
Would this work? Or are the writes buffered somehow?

It won't work, but not for the reason you think. The server may start
writing in between the client checking the flag and finishing the
reading.

A robust approach is to lock the file when reading or writing the
data. See section 2.5 of the FAQ for this newsgroup for information
on file locking. Since file locking is designed for exactly this sort
of situation, you can be sure that it will be free of races, as long
as you use it on every access.

Correct me if I'm wrong, but if you need more fine-grained locking, you
should be able to use sem_init() to create any number of semaphores in
the shared memory area.

That way the data collection routine could write a history of several
samples into the area, and a client could read them at its leisure.
And you could have a separate lock for each one, thus reducing the
chances that the client and server would need the lock at the same time.
The obvious way to do this would be with a circular buffer.

(This would be helpful if the client need to collect the data and
write it to a log file or something; it wouldn't have to worry much
about running super frequently so that it doesn't miss data.)

- Logan
.



Relevant Pages

  • Re: What doesnt lend itself to OO?
    ... >> proxy and instructs the server to constuct the real object. ... rather than client code. ... If 'clock' is instantiated in the server, ... > for the server interface at the OOA level. ...
    (comp.object)
  • This is going straight to the pool room
    ... or not the client has privilege to do what they're trying to do, ... The server environment is this: ... 3GL User action Routines that Tier3 will execute on your behalf during the ... Routine Name: USER_INIT ...
    (comp.os.vms)
  • [Full-Disclosure] R: Full-Disclosure Digest, Vol 3, Issue 42
    ... Full-Disclosure Digest, Vol 3, Issue 42 ... SD Server 4.0.70 Directory Traversal Bug ... Arkeia Network Backup Client Remote Access ...
    (Full-Disclosure)
  • Re: What doesnt lend itself to OO?
    ... > rather than client code. ... no way to do that without also touching the object with clock semantics ... will not encapsulate both clock semantics and network semantics. ... The server can do whatever it wants ...
    (comp.object)
  • RE: Fax monitor incoming + outgoing calls?
    ... problem between the client computer and the SBS server. ... Client is using the internal IP address of the SBS server as the ... To the folder redirection GPO issue: ...
    (microsoft.public.windows.server.sbs)