- Remove directory locking for Chain creation until BNode::Lock() is fixed.

- Creating 2 chains at the same time will result in problems now, but this is
  something unlikelly to happen (although not impossible).
- Added TODOs related to this.
- MDR is usable again inside Haiku and you can actually send emails when
  creating a mixed inbound/outbound account.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25160 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Bruno G. Albuquerque 2008-04-25 15:58:44 +00:00
parent 3dd2f0667e
commit 68d6c8f169
1 changed files with 8 additions and 1 deletions

View File

@ -55,7 +55,14 @@ NewMailChain()
BDirectory chain_dir(path.Path()); BDirectory chain_dir(path.Path());
BDirectory outbound_dir(&chain_dir,"outbound"), inbound_dir(&chain_dir,"inbound"); BDirectory outbound_dir(&chain_dir,"outbound"), inbound_dir(&chain_dir,"inbound");
chain_dir.Lock(); //---------Try to lock the directory // TODO(bga): We should lock the directory before reading its contents
// and updating the last_issued_chain_id to avoid race conditions in
// case 2 Chains are being created at the same time. Unfortunately,
// calling BNode::Lock() in the directory is preventing the attribute to
// written (and it should not). Add the locking back when this is fixed.
// TODO(bga): A better way to do all this anyway is to write the chain
// information to the settings message (a new field would be added).
int32 id = -1; //-----When inc'ed, we start with 0---- int32 id = -1; //-----When inc'ed, we start with 0----
chain_dir.ReadAttr("last_issued_chain_id",B_INT32_TYPE,0,&id,sizeof(id)); chain_dir.ReadAttr("last_issued_chain_id",B_INT32_TYPE,0,&id,sizeof(id));