On Sunday, Aug 24, 2003, at 11:43 Europe/Helsinki, Timo Sirainen wrote:
I just figured out that the lockless cache file reading prevents me from fixing the mbox code to work the same way it used to. I'm not sure actually how this would be best fixed.. Problem is that headers in mails change and move the messages around in the mailbox, so I have to keep track of them. Previously I just updated the header size in index files.. but without read locks this can't be done safely.
Stupid stupid stupid.
Why did it take this long to figure out.
Write: lock(); data[0] = stuff; data[1] = stuff; unlock(); Read: do { copy = data; } while (copy[0] != copy[1]);
There's my lockless reading for data that changes. Solves mbox problems, allows easily changing .imap.index to be read-lockless and probably more. Doubles the space requirements, but that's still small.