⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fiber.cpp

📁 The Spectral Toolkit is a C++ spectral transform library written by Rodney James and Chuck Panaccion
💻 CPP
字号:
//// spectral toolkit // copyright (c) 2005 university corporation for atmospheric research// licensed under the gnu general public license//#include "fiber.h"namespace spectral{  /// Fiber destructor.  fiber::~fiber() {}    /// Fiber constructor.  Initializes thread attributes.  fiber::fiber()  {    running=0;    pthread_attr_init(&attr);    pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_JOINABLE);    pthread_attr_setscope(&attr,PTHREAD_SCOPE_SYSTEM);  }    /// Thread creation method.  Starts thread associated with this object  /// which in turn invokes the virtual start method.  /// \return 0 for success, pthread_create error code otherwise  int fiber::spawn()  {    int r=pthread_create(&tid,&attr,fiber_wrapper,this);    if(r==0)      running=1;    return(r);   }  /// Thread join method.  Blocks until thread function returns if the thread   /// is running, otherwise returns immediately.  /// \return pointer returned from pthread_join    void* fiber::join()  {    void *status=0;    if(running)      pthread_join(tid,&status);    return(status);  }}  void* fiber_wrapper(void *object){  spectral::fiber *F=(spectral::fiber*)object;  F->start();  return(0);}

⌨️ 快捷键说明

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