首页 \ 问答 \ 使用:: InterlockedIncrement(VC ++)的唯一ID(Unique ID with ::InterlockedIncrement (VC++))

使用:: InterlockedIncrement(VC ++)的唯一ID(Unique ID with ::InterlockedIncrement (VC++))

使用VC ++来获取一个向上计数的唯一ID,我想知道这在多线程应用程序中是否合法?

uint32_t GetNewId() { return ::InterlockedIncrement(&lastId); }

基本上,我想知道InterlockedIncrement是否只是保护增量,或者返回值是否也能防止竞争条件?


Using VC++, to get a unique ID that counts upwards, I was wondering whether this is legal in a multi-threaded application?

uint32_t GetNewId() { return ::InterlockedIncrement(&lastId); }

Basically, I am wondering whether InterlockedIncrement just protects the increment, or whether the return value is also guarded against race conditions?


原文:https://stackoverflow.com/questions/6828094
更新时间:2022-12-06 16:12

最满意答案

这当然是可能的,但您也需要更改Detail.html

请换行

<f:render partial="Detail/FalMediaContainer" arguments="{media: newsItem.falMedia, settings:settings}" />

<f:render partial="Detail/FalMediaContainer" arguments="{newsItem:newsItem, media: newsItem.falMedia, settings:settings}" />

之后你可以在部分中使用{newsItem}任何属性!


This is of course possible, however you need to change the Detail.html as well.

Please change the line

<f:render partial="Detail/FalMediaContainer" arguments="{media: newsItem.falMedia, settings:settings}" />

into

<f:render partial="Detail/FalMediaContainer" arguments="{newsItem:newsItem, media: newsItem.falMedia, settings:settings}" />

afterwards you can use any property of the {newsItem}also in the partial!

相关问答

更多
  • 您可以使用Sanitize和Truncate的组合。 truncate("And they found that many people were sleeping better.", :omission => "... (continued)", :length => 15) # => And they found... (continued) 我正在做一个类似的任务,我有博客文章,我只想显示一个快速摘录。 所以在我看来,我只是在做: sanitize(truncate(blog_post.bod ...
  • 这当然是可能的,但您也需要更改Detail.html 。 请换行
    视图嵌入函数必须有两个参数: print views_embed_view($view_name , $display_id); 哪里: $ view_name - 是您创建的视图的名称。 $ display_id - 是您创建的视图的显示ID。 您可以为上下文过滤器使用其他参数: print views_embed_view('views_name', 'display_id', $term_id, $user_id, etc.. ); 在这种情况下,不需要额外的参数。 您可以使用您嵌入的内容类型的视 ...
  • 假设您的内容类型称为“博客”,则只要需要显示博客帖子,就会使用node-blog.tpl.php。 如果Drupal需要预告片显示,$ teaser变量将在node-blog.tpl.php中设置为TRUE,如果节点以完整页面视图显示,则$ page变量将设置为TRUE(它们都将是如果整个节点显示在节点列表中,则为FALSE)。 因此,您需要设置node-blog.tpl.php以检查所请求的显示类型,并返回适合给定类型的HTML。 你的node-blog.tpl.php的一般设置应该是这样的: if($t ...
  • 你需要扩展新闻数据与其他领域。 这在手册和这个博客 (ext:新闻被扩展,但文件结构是旧的)和本文 (当前的结构,但其他tabel被增强)中描述。 为了评估和显示你的领域,你需要修改ext:news的模板。 将必要的部分复制到您的扩展中并对其进行修改。 还要设置打字稿以包含您的模板,如手册中所述。 you need to extend the news data with further fields. This is described in the manual and this blog(ext:ne ...
  • 在Drupal 7中, node_view()函数没有$teaser参数,而是有一个$view_mode参数,它接受一个字符串(通常为teaser或full ,默认为full )。 您目前使用的代码可以完美地用于Drupal 6。 此代码适用于Drupal 7: $view_mode = 'teaser'; $nid = 20; $node = node_load($nid); print render(node_view($node, $view_mode)); In Drupal 7 there ...
  • 凯克,我找到了解决问题的方法。 在teaser.html (可以在site-packages-->djangocms-teaser )添加了width="***" 。 这使得图片显示的图片更小。 Kek, I've found a solution for my question. In teaser.html (can be found in site-packages-->djangocms-teaser) added width="***". That made images shown in tea ...
  • http://api.drupal.org/api/function/node_view/6 $node = node_load($n); $html = node_view($node,TRUE); 然后,您可以选择要在“ 内容类型”>“显示字段”上显示的字段,之后,您可以通过主题文件夹上的contemplate模块或node-content_type.tpl.php编辑该预告片的主题。 http://api.drupal.org/api/function/node_view/6 $node = nod ...
  • 转到admin/structure/types/manage/[CONTENT_TYPE]/display/teaser来管理所有字段的显示。 要配置图像的显示方式,请单击右侧的齿轮图标,选择所需的图像样式,然后单击“更新”。 (别忘了单击“保存”)。 要查看可用的图像样式并进行修改,请转至admin/config/media/image-styles 要添加新图像样式,请转至admin/config/media/image-styles/add 希望这有效......穆罕默德。 Go to admin/s ...
  • 我不相信有一种方法可以做到内置于哈基尔。 在我看来,你有两个选择: 在将文件呈现在自己的页面上之前写一个从文档中剥离预告片的过程 将预告片保留在实际页面中,但使用CSS隐藏它 第一个选项可能更好,但需要使用字符串操作和Hakyll编译器。 如果你想要一个地方开始,看看teaserFieldWithSeparator的实现,它使用teaserFieldWithSeparator中的needlePrefix函数从文档正文中提取预告片。 你必须做相反的事情:提取除了预告片之外的一切。 如果你采取这种方法,你可以将 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)