Skip to content

Conversation

@lylei
Copy link
Collaborator

@lylei lylei commented Mar 17, 2017

(#880)

};

void AddBlock(int64_t block_id, Disk* disk, BlockMeta meta) {
void AdBlock(int64_t block_id, Disk* disk, BlockMeta meta) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥删个字母?因为符号冲突了?

// return value from Disk::LoadStorage:
// 0: initial state, 1: done, -1: error occured
std::vector<int> ret_vals;
ret_vals.resize(disks_.size());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能保证初始值是0不?

return disk_quota_;
}

// TODO: concurrent load
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

// return value from Disk::LoadStorage:
// 0: initial state, 1: done, -1: error occured
std::vector<int> ret_vals;
ret_vals.resize(disks_.size(), 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以直接写成
std::vector ret_vals(disks_.size(), 0);

std::placeholders::_3));
disk_quota_ += disk->GetQuota();
std::placeholders::_3);
tp.AddTask(std::bind(&Disk::LoadStorage, disk, callback, &(ret_vals[disk_index])));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用不着这么多层括号吧, &ret_vals[disk_index]应该就是可以的

}
bool ret = true;
while (true) {
sleep(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉没必要上来就sleep一秒, 说不定已经完成了呢
sleep可以放循环的最后

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants