Commit Graph

46 Commits

Author SHA1 Message Date
Wander Lairson Costa 65d528a379 Implement eina_thread for native windows
Summary:
eina: Implement Eina_Thread for native windows

The implementation design respects the fact that Eina_Thread is an
uintptr_t. Thus we allocate the thread struct in the heap and return a
pointer to it.

As such, we store the created thread structure in the target thread
TLS slot. For threads that were not created through eina API, in
eina_thread_self we allocate a new structure, push it to the TLS slot
and mark it to be freed on thread exit.

Reviewers: jptiz, vtorri, cedric, walac

Reviewed By: jptiz, cedric

Subscribers: raster, cedric, #reviewers, #committers, lucas

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12037
2021-04-17 16:00:32 -03:00
Felipe Magno de Almeida ccc1849263 eina: Rename EAPI macro to EINA_API in Eina library
Summary:
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.

EAPI was designed to be able to pass
`__attribute__ ((visibility ("default")))` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.

MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.

For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.

With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).

Example 1:
dll1:
```
EAPI void foo(void);

EAPI void bar()
{
  foo();
}
```
dll2:
```
EAPI void foo()
{
  printf ("foo\n");
}
```

This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
`__atttribute__((visibility("default")))`

However, the following:
Example 2:

dll1:

```
EAPI extern int foo;
EAPI void foobar(void);

EAPI void bar()
{
  foo = 5;
  foobar();
}
```

dll2:

```
EAPI int foo = 0;
EAPI void foobar()
{
  printf ("foo %d\n", foo);
}
```

This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.

Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>

Reviewers: jptiz, lucas, woohyun, vtorri, raster

Reviewed By: jptiz, lucas, vtorri

Subscribers: ProhtMeyhet, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12188
2020-11-25 09:42:47 -03:00
Xavi Artigas 0fa18c0866 doxygen docs: Add missing docs for core Eina types
Things like EINA_LIKELY or EAPI were undocumented...
2020-03-27 13:33:04 +01:00
Myoungwoon Roy, Kim 3feacb2b66 docs: Fix Eina Core Group
Summary: I had fixed unlinked Eina API group(eina_main, eina_types, hamster) from Eina nodes. Those APIs included into Core group before.

Test Plan: API reference documentation modification only

Reviewers: segfaultxavi

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11605
2020-03-27 10:19:54 +01:00
Marcel Hollerbach 40a62ddf94 eina: introduce Eina_Abstract_Content
A little abstraction to have abstract data content bound to a type.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D11018
2020-03-08 10:59:22 +01:00
Xavi Artigas 9f4b5458ea doxygen: fix duplicated toc sections 2020-02-28 11:44:19 +01:00
Ali Alzyod 5137f6d143 eina: add new range Data type
Summary:
Introduce new data type (Eina.Range)  which represent range (part of series)

**eina_range_max_get**
**eina_range_intersect**
**eina_range_union**
**eina_range_contains**
**eina_range_equal**

Reviewers: cedric, woohyun, bu5hm4n, segfaultxavi, zmike

Reviewed By: woohyun

Subscribers: vtorri, cedric, #committers, #reviewers

Tags: #efl

Maniphest Tasks: T8570

Differential Revision: https://phab.enlightenment.org/D11133
2020-01-23 06:54:44 +09:00
Vincent Torri ce9cad3a3b Eina: replace Evil.h with evil_private.h and remove Evil.h when not necessary
Test Plan: compilation

Reviewers: raster, zmike, cedric

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8903
2019-05-16 13:48:59 -04:00
Marcel Hollerbach 7165003bc6 introduce eina_vpath!
Its the successor of efl.vpath, the api is synchronous, and supports
addtional vpath paths, new apis cal always be added to use them.
2018-02-22 09:26:55 +01:00
Andy Williams 9d09d722b9 eina: Update header for readability
Author Nate Drake
Reviewer: Andy Williams
2017-12-07 16:21:11 +00:00
Bryce Harrington dab3a6fca3 eina: Fix spelling/punctuation errors in documentation (thread..xattr)
Summary:
Also makes some of the doxygen comment line spacing/formatting
consistent.

Interesting ref on grammar of 'an uniform' vs. 'a uniform':
  https://english.stackexchange.com/questions/4700/is-it-a-uniform-or-an-uniform
It is AN honor to work with such A uniform language as English. *sigh*

Reviewers: cedric, ajwillia.ms

Subscribers: segfaultxavi, jpeg

Differential Revision: https://phab.enlightenment.org/D5459
2017-11-13 12:04:59 +09:00
Guilherme Iscaro 5bd8c9a78d Eina: Add Eina_Promise/Eina_Future.
This commit adds a new promise/future API which aims to replace
efl_future.
2017-09-04 10:24:00 -03:00
Daniel Zaoui 5f268ec26a First patch of the Eina Debug layer rewriting
Eina Debug is a new layer aimed for EFL debugging. It offers scalability
by allowing registration of operations not specific to EFL core.

The protocol is simple and the APIs try to provide as much
functionalities/freedom as possible.
2017-06-05 08:51:49 +03:00
Myoungwoon Roy, Kim ec71f6607a docs: Fix typos and some wrong expressions in Eina API reference doxygen.
Summary: I had fixed some typos and some wrong expressions, such as capital letters, singular, and orders of groups in Eina API reference doxygen.

Test Plan: Doxygen Revision

Reviewers: stefan, cedric, raster, Jaehyun_Cho, jpeg

Reviewed By: jpeg

Subscribers: conr2d

Differential Revision: https://phab.enlightenment.org/D4674
2017-02-21 10:46:28 +09:00
Jean-Philippe Andre 4550b4cf83 eina: Introduce Eina_Slstr for short-lived strings
Built on top of the new 'postponed' free queue, the short-lived
strings API allows users to return new strings without caring
about freeing them. EFL main loop will do this automatically for
them you at a later point in time (at the end of an iteration).

The APIs provided will either duplicate (copy) or more generally
steal an existing string (char *, stringshare, tmpstr, strbuf),
taking ownership of it and controling its lifetime. Those strings
can then be safely returned by an API. From a user point of view,
those strings must be considered like simple const char *, ie.
no need to free() them and their validity is limited to the
local scope.

There is no function to remove such a string from the freeq.

The short lived strings API is not thread-safe: do not send a
short-lived object from one thread to another.

@feature
2017-01-17 14:20:55 +09:00
Bruno Dilly adb95630ef eina: remove tests, examples and docs for eina_model
Summary:
Since eina_model was dropped some years ago.
Also a few other points where related stuff is just commented out.

Reviewers: iscaro, barbieri

Reviewed By: barbieri

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4442
2016-11-30 18:37:34 -02:00
Cedric BAIL de131bf5d0 eina: remove Eina_Promise. 2016-11-07 13:43:11 -08:00
Carsten Haitzler 0ee33e7b4b eina - add a free queue (eina_freeq) for deferring frees of data
this adds eina_freeq api's for c land for deferring freeing of
pointers and can be used a s a simple copy & paste drop-in for free()
just to "do this later". the pointer will eveentually be freed as
eina_shutdown will free the main free queue and this will in turn free
everything in it. as long as the main lo0op keeps pumping things will
og on the queue and then be freed from it. free queues have limits so
if they get full they will clear out old pointers and free them so it
won't grow without bound. the default max is 1mb of data or 16384
items whichever limit is hit first and at that point the oldest item
will be freed to make room for the newest. the mainloop whenever it
finishes idle enterers will add an idler to spin and free while idle.
the sizes can be tuned and aruged about as to what defaults should be.

this also allows for better memory debugging too by being able to fill
freed memory with patterns if its small enough etc. etc.

@feature
2016-11-06 13:13:10 +09:00
Gustavo Sverzut Barbieri 960e1a1d16 eina/ecore: allow threads to be canceled, use in ecore_con.
As discussed in the mailing list, many people will use worker threads
to execute blocking syscalls and mandating ecore_thread_check() for
voluntary preemption reduces the ecore_thread usefulness a lot.

A clear example is ecore_con usage of connect() and getaddrinfo() in
threads. If the connect timeout expires, the thread will be cancelled,
but it was blocked on syscalls and they will hang around for long
time. If the application exits, ecore will print an error saying it
can SEGV.

Then enable access to pthread_setcancelstate(PTHREAD_CANCEL_ENABLE)
via eina_thread_cancellable_set(EINA_TRUE), to pthread_cancel() via
eina_thread_cancel(), to pthread_cleanup_push()/pthread_cleanup_pop()
via EINA_THREAD_CLEANUP_PUSH()/EINA_THREAD_CLEANUP_POP() and so on.

Ecore threads will enforce non-cancellable threads on its own code,
but the user may decide to enable that and allow cancellation, that's
not an issue since ecore_thread now plays well and use cleanup
functions.

Ecore con connect/resolve make use of that and enable cancellable
state, efl_net_dialer_tcp benefits a lot from that.

A good comparison of the benefit is to run:

   ./src/examples/ecore/efl_io_copier_example tcp://google.com:1234 :stdout:

before and after. It will timeout after 30s and with this patch the
thread is gone, no ecore error is printed about possible SEGV.
2016-09-14 01:47:23 -03:00
Gustavo Sverzut Barbieri 9062bbd8e0 eina: introduce Eina_Slice and Eina_Rw_Slice.
A plain simple pointer + length describing a linear memory region.
2016-08-22 18:25:14 -03:00
Cedric BAIL 692b2c9fc9 eina: add generic infrastructure for a Eina_Safepointer
This is heavily inspired from Eo_Id infrastructure. Main change
are that the lower bit are always guaranteed to be zero and ignored
by all function. Also it may be a little bit less efficient in some
case, but we will tune it once we have real life usage of it.

Eo won't be migrated for 1.18 to it as Eo_Id is deeply integrated
and it is quite risky to touch it so close from a freeze. This can
wait.
2016-06-10 13:57:01 -07:00
Felipe Magno de Almeida 09eea7bc01 eina: add promise
Add a promise object that will allows Eolian interface to include promises
as a way to have asynchronous value return and composibility.

To understand better, let see the coming usage in a .eo file:

class Foo {
   methods {
      bar {
         params {
            @inout promise: Promise<int>;
         }
      }
   }
}

Which will create the following API interface:

void foo_bar(Eo* obj, Eina_Promise** promise);

and the equivalent declaration for implementation.

However, the API function will instantiate the Promise for the user
and the implementer of the class automatically. So the user of this
function will treat it as a @out parameter, while the developer of the
function will treat it like a @inout parameter.

So, the user will use this function like this:

Eina_Promise* promise; // No need to instantiate
foo_bar(obj, &promise);
eina_promise_then(promise, callback);

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
2016-04-05 11:35:12 -07:00
Jean-Philippe Andre d488926cb6 Eina: Move vector2 to eina_inline_vector.x
For consistency.

Also, include inside Eina.h
Thanks @vtorri for the remark.
2016-01-07 19:18:35 +09:00
Subhransu Mohanty ddb8515930 eina: add Eina_Bezier infrastructure for manipulating cubic bezier curves. 2015-08-07 14:33:52 +02:00
Cedric BAIL 0acf23857f eina: beginning of a generic quaternion API. 2015-05-29 17:20:29 +02:00
Vincent Torri dbc6cbb953 eina: add crosss platforme API to retrieve tmp and home directories from environment.
@feature

No tests added as it is highly dependent on the system and it would make little sens.

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-05-14 18:41:48 +02:00
Carsten Haitzler 2aeb289063 eina - begin event log infra we can get from the new debug monitor
we can down dump event logs. some ecore mainloop bits are logging at
the moment.
2015-05-10 19:05:54 +09:00
Cedric BAIL 0dfb263a28 eina: remove the need to order the header correctly for Windows. 2015-05-07 09:53:10 +02:00
vivek a2f2d942c6 eina: add CRC implementation to Eina module.
Summary:
Added eina_crc function in eina to calculate crc for the key passed and
added eina_hash_crc function for hashing using crc

Signed-off-by: vivek <vivek.ellur@samsung.com>

Reviewers: Sergeant_Whitespace, cedric

Reviewed By: cedric

Subscribers: Sergeant_Whitespace, cedric

Differential Revision: https://phab.enlightenment.org/D2260

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-05-07 09:53:09 +02:00
Cedric BAIL 659d3c4fd7 eina: add eina_matrix.
This code come from Enesim and was done by Jorge. I did just take care
of changing the namespace and coding style.
2015-04-03 16:12:48 +02:00
Tae-Hwan Kim dbe87afd63 eina: documentation enhance - add @brief tag
Summary: Add @brief for brief description

Reviewers: raster, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1577

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2014-10-27 09:08:47 +01:00
Ghislain Loaec 604d3ae8a2 eina: Eina_Cpu / Eina_Thread API documentation 2014-10-20 18:17:14 +02:00
Mike Blumenkrantz d7f729343b add eina_value_util.h to Eina.h 2014-09-23 15:56:46 -04:00
bluezery 8f30d8a949 Eina: Change from "" to <> for header inclusion
Summary:
All eina_xxx.h are expored headers.
Using system path to search eina headers seems to be better.

Reviewers: raster, stefan_schmidt, stefan, cedric

Subscribers: stefan_schmidt, cedric

Differential Revision: https://phab.enlightenment.org/D1079
2014-08-02 21:10:37 +02:00
Carsten Haitzler 3c130836ad new eina api/object - eina thread queues
@feature

This is a new feature for eina (and EFL) - a zero-copy thread message
queue for sending messages from one thread to another or from the
ecore mainloop to or back to the mainloop from threads. It has a
complete test suite too.
2014-07-15 20:39:13 +09:00
Daniel Juyung Seo a7399da8f6 Eina.h: bump up year. 2013-08-20 03:11:48 +09:00
Cedric BAIL 0e50f122e5 efl: Add eina copy on write infrastructure.
SVN revision: 82396
2013-01-08 09:17:56 +00:00
Gustavo Sverzut Barbieri 0a2d116119 efl: eina_alloca.h to simplify alloca() usage.
having to replicate 18 lines per file just to access alloca() is
insane. Let's do that in Eina.h and avoid that crap :-/



SVN revision: 82082
2013-01-03 15:10:34 +00:00
Gustavo Sverzut Barbieri 2608f68571 efl/docs: clean-up and make it more uniform.
now unified docs are bit more uniform in their start pages, overall
improved but much to do :-(



SVN revision: 81851
2012-12-28 23:26:05 +00:00
Gustavo Sverzut Barbieri e86d9e0dd9 efl/eina: fix doc for content access
SVN revision: 81831
2012-12-28 19:08:42 +00:00
Jonas M. Gastal a6b491fc01 efl: Created Eina group and added existing Eina groups to it.
SVN revision: 81290
2012-12-18 18:38:25 +00:00
Jonas M. Gastal d41d76ca38 efl: Modified section names as doxygen reuses titles for same named sections in different pages.
SVN revision: 81279
2012-12-18 16:18:28 +00:00
Jonas M. Gastal 65a7188905 efl: Unifying authors page.
SVN revision: 81277
2012-12-18 16:18:19 +00:00
Jonas M. Gastal 6ecaa33f22 efl: Adding a unified main page that links to the "mainpage" of libs.
SVN revision: 81273
2012-12-18 16:12:56 +00:00
Cedric BAIL 903bbfba82 efl: add Eina_Thread API.
SVN revision: 78225
2012-10-19 05:47:33 +00:00
Carsten Haitzler 0a5ba96837 move eina headers into lib/eina like the rest of efl - at least be
consistent with the majority.



SVN revision: 77119
2012-09-27 04:02:37 +00:00