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

📄 async_callback.h

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 H
字号:
//%2006//////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation, The Open Group.// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; Symantec Corporation; The Open Group.//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to// deal in the Software without restriction, including without limitation the// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or// sell copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions:// // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.////==============================================================================//// Author: Mike Day (mdday@us.ibm.com)//// Modified By: David Dillard, Symantec Corp. (david_dillard@symantec.com)////%/////////////////////////////////////////////////////////////////////////////#ifndef Pegasus_async_callback_h#define Pegasus_async_callback_h#include <Pegasus/Common/Config.h>#include <sys/types.h>#if !defined(PEGASUS_OS_TYPE_WINDOWS)#include <unistd.h>#endif#include <Pegasus/Common/PegasusAssert.h>#include <iostream>#include <stdio.h>#include <string.h>#include <Pegasus/Common/Config.h>#include <Pegasus/Common/InternalException.h>#include <Pegasus/Common/MessageQueue.h>#include <Pegasus/Common/Thread.h>#include <Pegasus/Common/Array.h>#include <Pegasus/Common/AsyncOpNode.h>#include <Pegasus/Common/CimomMessage.h>#include <Pegasus/Common/Cimom.h>#include <Pegasus/Common/MessageQueueService.h>PEGASUS_NAMESPACE_BEGINclass test_async_queue;class async_start : public AsyncOperationStart{   public:      typedef AsyncOperationStart Base;      async_start(AsyncOpNode *op,		  Uint32 start_q,		  Uint32 completion_q,		  Message *op_data);      virtual ~async_start(void) { }   private:      friend class test_async_queue;};class async_complete: public AsyncOperationResult{   public:      typedef AsyncOperationResult Base;      async_complete(const async_start & start_op,		     Uint32 result,		     Message *result_data);      virtual ~async_complete(void) {    delete _result_data; }      Message *get_result_data(void);   private:      Message *_result_data;      friend class test_async_queue;};class test_async_queue : public MessageQueueService{   public:      typedef MessageQueueService Base;      enum ROLE      {	 CLIENT,	 SERVER      };      test_async_queue(ROLE role);      virtual ~test_async_queue(void) { }      // pure virtuals that will go away eventually      void handleEnqueue(void)      {	 Message *msg = dequeue();	 if(msg)	    handleEnqueue(msg);      }      void handleEnqueue(Message *msg)      {	 delete msg;      }      // static callback function      static void async_handleEnqueue(AsyncOpNode *op, MessageQueue *, void *);      static void async_handleSafeEnqueue(Message *, void *, void *);      static AtomicInt msg_count;      AtomicInt _die_now;   protected:      virtual Boolean messageOK(const Message *);      virtual void _handle_async_request(AsyncRequest *req);      virtual void _handle_async_callback(AsyncOpNode *operation);   private:      test_async_queue(void);      void _handle_stop(CimServiceStop *stop);      ROLE _role;};PEGASUS_NAMESPACE_END#endif // Pegasus_async_callback_h

⌨️ 快捷键说明

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