XDispatch 0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
group.h
Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2011-2012 MLBA-Team. All rights reserved.
00003 *
00004 * @MLBA_OPEN_LICENSE_HEADER_START@
00005 *
00006 * Licensed under the Apache License, Version 2.0 (the "License");
00007 * you may not use this file except in compliance with the License.
00008 * You may obtain a copy of the License at
00009 *
00010 *     http://www.apache.org/licenses/LICENSE-2.0
00011 *
00012 * Unless required by applicable law or agreed to in writing, software
00013 * distributed under the License is distributed on an "AS IS" BASIS,
00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 * See the License for the specific language governing permissions and
00016 * limitations under the License.
00017 *
00018 * @MLBA_OPEN_LICENSE_HEADER_END@
00019 */
00020 
00021 
00022 #ifndef XDISPATCH_GROUP_H_
00023 #define XDISPATCH_GROUP_H_
00024 
00030 #ifndef __XDISPATCH_INDIRECT__
00031 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00032 #endif
00033 
00034 #include <iostream>
00035 
00036 __XDISPATCH_BEGIN_NAMESPACE
00037 
00048 class XDISPATCH_EXPORT group : public object {
00049 
00050     public:
00054         group();
00058         group(dispatch_group_t);
00059         group(const group&);
00060         ~group();
00061 
00067         void async(operation* r, const queue& q = global_queue());
00068 #ifdef XDISPATCH_HAS_BLOCKS
00069 
00073         inline void async(dispatch_block_t b, const queue& q = global_queue()) {
00074             async( new block_operation(b), q );
00075         }
00076 #endif
00077 
00083         bool wait(dispatch_time_t t = DISPATCH_TIME_FOREVER);
00090         bool wait(struct tm* timeout);
00103         void notify(operation* r, const queue& q = global_queue());
00104 #ifdef XDISPATCH_HAS_BLOCKS
00105 
00117         inline void notify(dispatch_block_t b, const queue& q = global_queue()) {
00118             notify( new block_operation(b), q );
00119         }
00120 #endif
00121 
00126         virtual dispatch_object_t native() const;
00132         dispatch_group_t native_group() const;
00133 
00134         group& operator=(const group&);
00135 
00136     private:
00137         class data;
00138         pointer<data>::unique d;
00139 };
00140 
00141 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream&, const group* );
00142 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream&, const group& );
00143 
00144 __XDISPATCH_END_NAMESPACE
00145 
00148 #endif /* XDISPATCH_GROUP_H_ */

Generated on Tue Jun 12 2012 14:11:47 for XDispatch by Doxygen 1.8.0
© 2010-2012 MLBA (about | privacy) All Rights reserved.