1 /** @file
2 
3   A brief file description
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 #include "I_Tasks.h"
25 
26 // Globals
27 EventType ET_TASK = ET_CALL;
28 TasksProcessor tasksProcessor;
29 
30 EventType
register_event_type()31 TasksProcessor::register_event_type()
32 {
33   ET_TASK = eventProcessor.register_event_type("ET_TASK");
34   return ET_TASK;
35 }
36 
37 // Note that if the number of task_threads is 0, all continuations scheduled for
38 // ET_TASK ends up running on ET_CALL (which is the net-threads).
39 int
start(int task_threads,size_t stacksize)40 TasksProcessor::start(int task_threads, size_t stacksize)
41 {
42   eventProcessor.spawn_event_threads(ET_TASK, std::max(1, task_threads), stacksize);
43   return 0;
44 }
45