由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - single producer single consumer issue
相关主题
求救: 打印binary tree一到电面题
delete a node in linked listcareercup第12.5题目求助?
一道电话题大牛们帮忙,Rverse Nodes in k-Group
how to code this question of LinkedInCracking上一道题求教
二叉树按层次打印有没有办法换行显示?麻烦谁给贴一个producer-consumer的面试题
问到linked list 的题目碰到一道题
一个stack怎么sortF家面经
谁有较好的iterative后序遍历binary tree的代码?电面问题
相关话题的讨论汇总
话题: node话题: single话题: myqueue话题: producer话题: temp
进入JobHunting版参与讨论
1 (共1页)
p*********r
发帖数: 48
1
No need to use any lock for a single producer single consumer queue. For
instance, I think the following code is multi-thread-safe. Am I right?
class myQueue
{
public:
struct Node {
Node (int v = 0) : value(v), next (0) {}
int value;
Node * next;
};
myQueue ()
{
first = last = new Node; // dummy node
}

~myQueue ()
{
while (first) {
Node * temp = first->next;
delete temp;
first = temp;
1 (共1页)
进入JobHunting版参与讨论
相关主题
电面问题二叉树按层次打印有没有办法换行显示?
Re: 一道count frequency of all words的面试题 (转载)问到linked list 的题目
这道设计题怎么做?一个stack怎么sort
求个可行的producer/consumer java 例子谁有较好的iterative后序遍历binary tree的代码?
求救: 打印binary tree一到电面题
delete a node in linked listcareercup第12.5题目求助?
一道电话题大牛们帮忙,Rverse Nodes in k-Group
how to code this question of LinkedInCracking上一道题求教
相关话题的讨论汇总
话题: node话题: single话题: myqueue话题: producer话题: temp