本文整理汇总了C++中Transaction::Done方法的典型用法代码示例。如果您正苦于以下问题:C++ Transaction::Done方法的具体用法?C++ Transaction::Done怎么用?C++ Transaction::Done使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction::Done方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
static status_t
ext2_write(fs_volume* _volume, fs_vnode* _node, void* _cookie, off_t pos,
const void* buffer, size_t* _length)
{
TRACE("ext2_write()\n");
Volume* volume = (Volume*)_volume->private_volume;
Inode* inode = (Inode*)_node->private_node;
if (volume->IsReadOnly())
return B_READ_ONLY_DEVICE;
if (inode->IsDirectory()) {
*_length = 0;
return B_IS_A_DIRECTORY;
}
TRACE("ext2_write(): Preparing cookie\n");
file_cookie* cookie = (file_cookie*)_cookie;
if ((cookie->open_mode & O_APPEND) != 0)
pos = inode->Size();
TRACE("ext2_write(): Creating transaction\n");
Transaction transaction;
status_t status = inode->WriteAt(transaction, pos, (const uint8*)buffer,
_length);
if (status == B_OK)
status = transaction.Done();
if (status == B_OK) {
TRACE("ext2_write(): Finalizing\n");
ReadLocker lock(*inode->Lock());
if (cookie->last_size != inode->Size()
&& system_time() > cookie->last_notification
+ INODE_NOTIFICATION_INTERVAL) {
notify_stat_changed(volume->ID(), -1, inode->ID(),
B_STAT_MODIFICATION_TIME | B_STAT_SIZE | B_STAT_INTERIM_UPDATE);
cookie->last_size = inode->Size();
cookie->last_notification = system_time();
}
}
TRACE("ext2_write(): Done\n");
return status;
}