Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
parallel-executor.h
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 
16 #ifndef IMPALA_RUNTIME_PARALLEL_EXECUTOR_H
17 #define IMPALA_RUNTIME_PARALLEL_EXECUTOR_H
18 
19 #include <boost/function.hpp>
20 #include <boost/thread/mutex.hpp>
21 
22 #include "common/status.h"
24 
25 namespace impala {
26 
34  public:
42  typedef boost::function<Status (void* arg)> Function;
43 
47  //
49  static Status Exec(Function function, void** args, int num_args,
50  StatsMetric<double>* latencies = NULL);
51 
52  private:
55  //
58  static void Worker(Function function, void* arg, boost::mutex* lock, Status* status,
59  StatsMetric<double>* latencies);
60 };
61 
62 }
63 
64 #endif
static void Worker(Function function, void *arg, boost::mutex *lock, Status *status, StatsMetric< double > *latencies)
boost::function< Status(void *arg)> Function
static Status Exec(Function function, void **args, int num_args, StatsMetric< double > *latencies=NULL)
Callers may pass a StatsMetric to gather the latency distribution of task execution.