[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] dynamisk array af semaforer



valentin <sslug@sslug> writes:

> 2) Hvordan håndterer man det, hvis man ønsker at gemme og tilgå en
> hægtet liste i shared memory? vi skal gemme oplysninger i en hægtet
> liste, som flere processer skal kunne tilgå.

Nu kan jeg bare ikke huske noget som helst om C, men:

struct shared-list {
  sem* lock;
  list* first;
}

struct list {
  void* payload;
  list* next;
  /* Den skulle ikke vere dobbelthægtet, vel? */
}

void insert(shared-list* self, void* obj) {
  aquire(self->lock);
  /* sanity check af obj (er den i den delte del af hukkomelsen?) */  

  /* insert-code here */
  release(self->lock);
}

Og ligende for alle de andre listefunktioner.

Så sørg bare for altid at bruge de rigtige funktioner og lad være med
lige at vide noget om at en shared-list bare er en struktur med en
pointer til en helt almindelig liste.


-- 
FAQ about my previous signature:
Q: What does it mean?
A: "Sid regler!" is some kind of translation of "Sid rulez!" into danish
   Sid is the new, rather cool, character in the internet-based cartoon
   at http://www.userfriendly.org.


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *