summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_thread.h
blob: e615e27c43d58fb78fdbac9a1b6493372850aa84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* EINA - EFL data type library
 * Copyright (C) 2012 Cedric Bail
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library;
 * if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef EINA_THREAD_H_
#define EINA_THREAD_H_

#include "eina_config.h"
#include "eina_types.h"
#include "eina_error.h"

/**
 * @addtogroup Eina_Tools_Group Tools
 *
 * @{
 */

/**
 * @defgroup Eina_Thread_Group Thread
 *
 * @{
 */

#ifdef EINA_HAVE_THREADS
# ifdef _WIN32_WCE

typedef unsigned long int Eina_Thread;

# elif defined(_WIN32)

typedef unsigned long int Eina_Thread;

# else
#  include <pthread.h>

typedef pthread_t Eina_Thread;

# endif
#else
# error "Build without thread is not supported any more"
#endif

typedef void *(*Eina_Thread_Cb)(void *data, Eina_Thread t);

typedef enum _Eina_Thread_Priority
{
  EINA_THREAD_URGENT,
  EINA_THREAD_NORMAL,
  EINA_THREAD_BACKGROUND,
  EINA_THREAD_IDLE
} Eina_Thread_Priority;

EAPI Eina_Thread eina_thread_self(void);
EAPI Eina_Bool eina_thread_equal(Eina_Thread t1, Eina_Thread t2);
EAPI Eina_Bool eina_thread_create(Eina_Thread *t,
                                  Eina_Thread_Priority prio, Eina_Bool affinity,
                                  Eina_Thread_Cb func, const void *data);
EAPI void *eina_thread_join(Eina_Thread t);

/**
 * @}
 */

/**
 * @}
 */

#endif