scriptqueue.cc

来自「编译工具」· CC 代码 · 共 57 行

CC
57
字号
//// scriptQueue.cc//// Implementation of simple FIFO queue for Tcl/Tk scripts awaiting evaluation.// Note that strings are copied on entry, and can be deleted after dequeuing.//// Note also that we queue a condition variable along with each entry.  For// entries made from omniParTclAndRun(), this condition variable will be// null, but for those from omniParTclAndWait() it will be non-null and will// be used to signal the waiting thread to wake up after the script has been// evaluated in the Tcl/Tk thread.//// $Id: scriptQueue.cc,v 1.2 1999/05/31 15:58:25 sll Exp $ $Author: sll $// #include <string.h>#include "omnithread.h"#include "scriptQueue.h"void scriptQueue::enq(char *script, omni_condition *cond){  char *newscript = new char[strlen(script)+1];  strcpy(newscript,script);  sqe *newsqe = new sqe;  newsqe->scp.script = newscript;  newsqe->scp.cond = cond;  newsqe->next = 0;    if (!head) {    head = tail = newsqe;  }  else {    tail->next = newsqe;    tail = newsqe;  }}scriptcondpair scriptQueue::deq(){  scriptcondpair scp;    if (!head) {    scp.script = (char *)0;  }  else {    sqe *hq = head;    scp = head->scp;    head = head->next;    delete hq;  }  return scp;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?