Click here to Skip to main content
15,915,336 members

Comments by tuccio (Top 8 by date)

tuccio 24-May-11 7:54am View    
well i made the assumption that no one is going to grab the lock, because i've a std::map containing locks and i access this map in mutual exclusion, so, while i've the lock on the map, no one is going to grab it, because no one can access it (i know this sounds weird and inefficient, but it's the easiest solution i've found, and i've not requirements of efficience)

of course this map mutual exclusion implies no one can access waiting variabile, so this is a kind of interlocked increment too

my point is that i've this std::map<ino_t,> to lock files on a thread base, i add locks to this map when i request lock for the file, but i need a condition to remove them safely, to avoid the map being full of useless locks
tuccio 3-Apr-11 9:20am View    
you should ask my professor :D

i see you're italian, so i just paste: "Non e' consentito cioe' accesso ne' in lettura ne' in scrittura da parte di altre istanze del server tftp allo stesso file mentre il file viene scritto."

i'm expressly required to do so :/
tuccio 2-Apr-11 17:13pm View    
because i'm expressly required not to allow multiple server instances to access the same files when one of them is writing

maybe i could find a way to combine flock and rwlocks safely
tuccio 2-Apr-11 12:32pm View    
ok, i've been told i should use an allocator, but that looks complicated to be honest
tuccio 2-Apr-11 7:10am View    
well.. how? i mean, and how can i be sure that no memory will be allocated out of my data segment? i guess that any "new" would be a problem, isn't it?