\begin{DoxyDate}{Date}
2012 (created)
\end{DoxyDate}
\hypertarget{eina_cxx_main_toc}{}\section{Table of Contents}\label{eina_cxx_main_toc}
\begin{DoxyItemize}
\item \hyperlink{eio_main_eio_main_intro}{Introduction} \item \hyperlink{eio_main_eio_main_compiling}{How to compile} \item \hyperlink{eio_main_eio_main_next_steps}{Next Steps} \item \hyperlink{eio_main_eio_main_intro_example}{Introductory Example}\end{DoxyItemize}
\hypertarget{eio_main_eio_main_intro}{}\section{Introduction}\label{eio_main_eio_main_intro}
The Eio library is a library that implements an A\+P\+I for asynchronous input/output operation. Most operation are done in a separated thread to prevent lock. See Eio\+\_\+\+Group. Some helper to work on data received in Eio callback are also provided see \hyperlink{group__Eio__Helper}{Eio Reference helper A\+P\+I}. It is also possible to work asynchronously on Eina\+\_\+\+File with \hyperlink{group__Eio__Map}{Manipulate an Eina\+\_\+\+File asynchronously} or on Eet\+\_\+\+File with \hyperlink{group__Eio__Eet}{Eio asynchronous A\+P\+I for Eet file.}. It come with way to manipulate e\+Xtended attribute assynchronously with \hyperlink{group__Eio__Xattr}{Eio manipulation of e\+Xtended attribute.}.

This library is cross-\/platform and can be compiled and used on Linux, B\+S\+D, Opensolaris and Windows (X\+P and C\+E). It is heavily based on \hyperlink{group__Ecore__Main__Loop__Group}{Ecore main loop}.\hypertarget{eio_main_eio_main_compiling}{}\section{How to compile}\label{eio_main_eio_main_compiling}
Eio is a library your application links to. The procedure for this is very simple. You simply have to compile your application with the appropriate compiler flags that the {\ttfamily pkg-\/config} script outputs. For example\+:

Compiling C or C++ files into object files\+:

\begin{DoxyVerb}gcc -c -o main.o main.c `pkg-config --cflags eio`
\end{DoxyVerb}


Linking object files into a binary executable\+:

\begin{DoxyVerb}gcc -o my_application main.o `pkg-config --libs eio`
\end{DoxyVerb}


See \hyperlink{pkgconfig}{pkgconfig}\hypertarget{eio_main_eio_main_next_steps}{}\section{Next Steps}\label{eio_main_eio_main_next_steps}
After you understood what Eio is and installed it in your system you should proceed understanding the programming interface.

Recommended reading\+:

\begin{DoxyItemize}
\item \hyperlink{group__Eio__Helper}{Eio Reference helper A\+P\+I} for common functions and library initialization. \item \hyperlink{group__Eio__Map}{Manipulate an Eina\+\_\+\+File asynchronously} to manipulate files asynchronously (mmap). \item \hyperlink{group__Eio__Xattr}{Eio manipulation of e\+Xtended attribute.} to access file extended attributes (xattr). \item \hyperlink{group__Eio__Monitor}{Eio file and directory monitoring A\+P\+I} to monitor for file changes (inotify). \item \hyperlink{group__Eio__Eet}{Eio asynchronous A\+P\+I for Eet file.} to access Eet files asynchronously.\end{DoxyItemize}
\hypertarget{eio_main_eio_main_intro_example}{}\section{Introductory Example}\label{eio_main_eio_main_intro_example}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -o eio\_file\_ls eio\_file\_ls.c `pkg-config --cflags --libs ecore eio`}

\textcolor{preprocessor}{#include <stdlib.h>}
\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <string.h>}
\textcolor{preprocessor}{#include <\hyperlink{Eio_8h}{Eio.h}>}
\textcolor{preprocessor}{#include <Ecore.h>}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_filter\_cb(\textcolor{keywordtype}{void} *data EINA\_UNUSED, \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *handler EINA\_UNUSED, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *file)
\{
   \textcolor{keywordtype}{char} *last\_slash = strrchr(file, \textcolor{charliteral}{'/'});

   \textcolor{comment}{//Check if it is a hidden file}
   \textcolor{keywordflow}{if} (last\_slash != NULL && strlen(last\_slash) > 1 && last\_slash[1] == \textcolor{charliteral}{'.'})
     \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};

   \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_main\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *handler EINA\_UNUSED, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *file)
\{
   \textcolor{keywordtype}{int} *number\_of\_listed\_files = (\textcolor{keywordtype}{int} *)data;

   fprintf(stdout, \textcolor{stringliteral}{"Processing file:%s\(\backslash\)n"}, file);

   (*number\_of\_listed\_files)++;
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_done\_cb(\textcolor{keywordtype}{void} *data, \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *handler EINA\_UNUSED)
\{
   \textcolor{keywordtype}{int} *number\_of\_listed\_files = (\textcolor{keywordtype}{int} *)data;

   fprintf(stdout, \textcolor{stringliteral}{"Number of listed files:%d\(\backslash\)n"} \(\backslash\)
           \textcolor{stringliteral}{"ls operation is done, quitting.\(\backslash\)n"}, *number\_of\_listed\_files);

   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_error\_cb(\textcolor{keywordtype}{void} *data EINA\_UNUSED, \hyperlink{Eio_8h_a1145f009745ecb4d9f6a01a9bc5a9ac0}{Eio\_File} *handler EINA\_UNUSED, \textcolor{keywordtype}{int} error)
\{
   fprintf(stderr, \textcolor{stringliteral}{"Something wrong has happend:%s\(\backslash\)n"}, strerror(error));
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   \textcolor{keywordtype}{int} number\_of\_listed\_files = 0;

   \hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}();
   \hyperlink{group__Eio__Helper_gac612fe5df9b9c93c275ee373745c2471}{eio\_init}();

   \textcolor{keywordflow}{if} (argc < 2)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"You must pass a path to execute the command.\(\backslash\)n"});
        \textcolor{keywordflow}{return}  -1;
     \}

   \hyperlink{Eio_8h_a0c22f9fa90963fa681a95268881e03dc}{eio\_file\_ls}(argv[1], \_filter\_cb, \_main\_cb, \_done\_cb, \_error\_cb,
               &number\_of\_listed\_files);

   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Eio__Helper_ga2281001078f6f99e3662bc889524831b}{eio\_shutdown}();
   \hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}
\end{DoxyCodeInclude}


More examples can be found at \hyperlink{eio_examples}{Eio Examples}. 