\hypertarget{group__Eina__Promise}{}\doxysection{Eina\+\_\+\+Promise}
\label{group__Eina__Promise}\index{Eina\_Promise@{Eina\_Promise}}


Creates a new promise.  


\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Promise_gacb03ddb85df3412ce53db9f43d7ce759}\label{group__Eina__Promise_gacb03ddb85df3412ce53db9f43d7ce759}} 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} Eina\+\_\+\+Promise $\ast$ {\bfseries eina\+\_\+promise\+\_\+new} (\mbox{\hyperlink{struct__Eina__Future__Scheduler}{Eina\+\_\+\+Future\+\_\+\+Scheduler}} $\ast$scheduler, \mbox{\hyperlink{group__Eina__Promise_ga328997a45f6c2645410b9d2201859ed7}{Eina\+\_\+\+Promise\+\_\+\+Cancel\+\_\+\+Cb}} cancel\+\_\+cb, const void $\ast$data)
\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} Eina\+\_\+\+Promise $\ast$ \mbox{\hyperlink{group__Eina__Promise_ga1464d3d3f6a5eaea0b7ba51a78065ee2}{eina\+\_\+promise\+\_\+continue\+\_\+new}} (const Eina\+\_\+\+Future $\ast$dead\+\_\+future, \mbox{\hyperlink{group__Eina__Promise_ga328997a45f6c2645410b9d2201859ed7}{Eina\+\_\+\+Promise\+\_\+\+Cancel\+\_\+\+Cb}} cancel\+\_\+cb, const void $\ast$data)
\begin{DoxyCompactList}\small\item\em Creates a new promise from a dead\+\_\+future. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void \mbox{\hyperlink{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}{eina\+\_\+promise\+\_\+resolve}} (Eina\+\_\+\+Promise $\ast$p, \mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}} value)
\begin{DoxyCompactList}\small\item\em Resolves a promise. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void \mbox{\hyperlink{group__Eina__Promise_gac2390dbab710385eac56b38395bc2a7a}{eina\+\_\+promise\+\_\+reject}} (Eina\+\_\+\+Promise $\ast$p, \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} err)
\begin{DoxyCompactList}\small\item\em Rejects a promise. \end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{group__Eina__Promise_ga16889dc3c6bc52c6dbaf38f6d5a408cc}\label{group__Eina__Promise_ga16889dc3c6bc52c6dbaf38f6d5a408cc}} 
typedef struct \mbox{\hyperlink{struct__Eina__Future__Desc}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Desc}} {\bfseries Eina\+\_\+\+Future\+\_\+\+Desc}
\item 
\mbox{\Hypertarget{group__Eina__Promise_gacefaa8aec3640aeec82fbc98d3b91ffd}\label{group__Eina__Promise_gacefaa8aec3640aeec82fbc98d3b91ffd}} 
typedef struct \+\_\+\+Eina\+\_\+\+Promise {\bfseries Eina\+\_\+\+Promise}
\item 
\mbox{\Hypertarget{group__Eina__Promise_gaf20dcb0e49b00047f8bd816ac60eb582}\label{group__Eina__Promise_gaf20dcb0e49b00047f8bd816ac60eb582}} 
typedef struct \+\_\+\+Eina\+\_\+\+Future {\bfseries Eina\+\_\+\+Future}
\item 
\mbox{\Hypertarget{group__Eina__Promise_ga6ec8cbc4cffe7c46d10b9a4ff22cc4dc}\label{group__Eina__Promise_ga6ec8cbc4cffe7c46d10b9a4ff22cc4dc}} 
typedef struct \mbox{\hyperlink{struct__Eina__Future__Cb__Easy__Desc}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Easy\+\_\+\+Desc}} {\bfseries Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Easy\+\_\+\+Desc}
\item 
\mbox{\Hypertarget{group__Eina__Promise_ga31ab2a1cdcd063f5488796a34d6f532b}\label{group__Eina__Promise_ga31ab2a1cdcd063f5488796a34d6f532b}} 
typedef struct \mbox{\hyperlink{struct__Eina__Future__Cb__Console__Desc}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Console\+\_\+\+Desc}} {\bfseries Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Console\+\_\+\+Desc}
\item 
\mbox{\Hypertarget{group__Eina__Promise_ga3d2245e1c0c2491b4a8ff7a2ef4648c4}\label{group__Eina__Promise_ga3d2245e1c0c2491b4a8ff7a2ef4648c4}} 
typedef struct \mbox{\hyperlink{struct__Eina__Future__Scheduler}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Scheduler}} {\bfseries Eina\+\_\+\+Future\+\_\+\+Scheduler}
\item 
\mbox{\Hypertarget{group__Eina__Promise_ga7983586afe4d5d3a8edb0056e8c551ad}\label{group__Eina__Promise_ga7983586afe4d5d3a8edb0056e8c551ad}} 
typedef struct \mbox{\hyperlink{struct__Eina__Future__Schedule__Entry}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Schedule\+\_\+\+Entry}} {\bfseries Eina\+\_\+\+Future\+\_\+\+Schedule\+\_\+\+Entry}
\item 
\mbox{\Hypertarget{group__Eina__Promise_gaae711cf191db29f824e4fd39ed992929}\label{group__Eina__Promise_gaae711cf191db29f824e4fd39ed992929}} 
typedef struct \mbox{\hyperlink{struct__Eina__Future__Race__Result}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Race\+\_\+\+Result}} {\bfseries Eina\+\_\+\+Future\+\_\+\+Race\+\_\+\+Result}
\item 
\mbox{\Hypertarget{group__Eina__Promise_gafd20515f3fd59d5b3dbe70114d0a8840}\label{group__Eina__Promise_gafd20515f3fd59d5b3dbe70114d0a8840}} 
typedef struct \mbox{\hyperlink{struct__Eina__Future__Cb__Log__Desc}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Log\+\_\+\+Desc}} {\bfseries Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Log\+\_\+\+Desc}
\item 
typedef \mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}}($\ast$ \mbox{\hyperlink{group__Eina__Promise_gad3a38a209f2112fbe1eb111e0d3ff939}{Eina\+\_\+\+Future\+\_\+\+Cb}}) (void $\ast$data, const \mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}} value, const Eina\+\_\+\+Future $\ast$dead\+\_\+future)
\item 
typedef void($\ast$ \mbox{\hyperlink{group__Eina__Promise_gac685b488df7948131b6405451d0b4fb5}{Eina\+\_\+\+Future\+\_\+\+Scheduler\+\_\+\+Cb}}) (Eina\+\_\+\+Future $\ast$f, \mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}} value)
\item 
typedef void($\ast$ \mbox{\hyperlink{group__Eina__Promise_ga328997a45f6c2645410b9d2201859ed7}{Eina\+\_\+\+Promise\+\_\+\+Cancel\+\_\+\+Cb}}) (void $\ast$data, const Eina\+\_\+\+Promise $\ast$dead\+\_\+promise)
\item 
typedef \mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}}($\ast$ \mbox{\hyperlink{group__Eina__Promise_ga93b2841efbc82b31ea37cf0edeb60a9d}{Eina\+\_\+\+Future\+\_\+\+Success\+\_\+\+Cb}}) (void $\ast$data, const \mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}} value)
\item 
typedef \mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}}($\ast$ \mbox{\hyperlink{group__Eina__Promise_gaa851e400869a2ca7b072d348175bd83f}{Eina\+\_\+\+Future\+\_\+\+Error\+\_\+\+Cb}}) (void $\ast$data, const \mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}} error)
\item 
typedef void($\ast$ \mbox{\hyperlink{group__Eina__Promise_ga8d3d898f0c73827404fc2e258767a6c7}{Eina\+\_\+\+Future\+\_\+\+Free\+\_\+\+Cb}}) (void $\ast$data, const Eina\+\_\+\+Future $\ast$dead\+\_\+future)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Creates a new promise. 

This function creates a new promise which can be used to create a future using \mbox{\hyperlink{group__Eina__Future_ga4ae0bbfdefe911b043e0ae5b4d030e7e}{eina\+\_\+future\+\_\+new()}}. Every time a promise is created a \mbox{\hyperlink{group__Eina__Promise_ga328997a45f6c2645410b9d2201859ed7}{Eina\+\_\+\+Promise\+\_\+\+Cancel\+\_\+\+Cb}} must be provided which is used to free resources that were created.

A promise may be canceled directly by calling {\ttfamily eina\+\_\+future\+\_\+cancel}(eina\+\_\+future\+\_\+new(eina\+\_\+promise\+\_\+new(...))) that is, canceling any future that is chained to receive the results.

However promises can be canceled indirectly by other entities. These other entities will call {\ttfamily eina\+\_\+future\+\_\+cancel()} themselves, however you may not be aware of that. Some common sources of indirect cancellations\+:

\begin{DoxyItemize}
\item A subsystem was shutdown, canceling all pending futures (i.\+e.\+: \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\+\_\+shutdown()}})\end{DoxyItemize}
\begin{DoxyItemize}
\item An EO object was linked to the promise or future, then if the object dies (last reference is gone), then the pending promises and futures will be canceled.\end{DoxyItemize}
\begin{DoxyItemize}
\item Some other entity (library provider or library user) chained and canceled his future, which will result in your future being canceled.\end{DoxyItemize}
Since a promise may be canceled indirectly (by code sections that goes beyond your scope) you should always provide a cancel callback, even if you think you\textquotesingle{}ll not need it.

Here\textquotesingle{}s a typical example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Ecore.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_promise\_cancel(\textcolor{keywordtype}{void} *data, Eina\_Promise *p \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{  Ctx *ctx = data;}
\DoxyCodeLine{  \textcolor{comment}{// In case the promise is canceled we must stop the timer!}}
\DoxyCodeLine{  \mbox{\hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}}(ctx-\/>timer);}
\DoxyCodeLine{  free(ctx);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_promise\_resolve(\textcolor{keywordtype}{void} *data)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Ctx *ctx = data;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}} v;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Value__Value__Group_gab5c6558b1b8be2ad597d71a765cbf5f6}{eina\_value\_setup}}(\&v, \mbox{\hyperlink{group__Eina__Value__Group_ga916f76c8d5ffd4c3ee3c322a54efd0b7}{EINA\_VALUE\_TYPE\_STRING}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Value__Value__Group_ga9a1407c953694c3d6f40ab01ebe9a294}{eina\_value\_set}}(\&v, \textcolor{stringliteral}{"Promise resolved"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}{eina\_promise\_resolve}}(ctx-\/>p, v);}
\DoxyCodeLine{   free(ctx);}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{Eina\_Promise *}
\DoxyCodeLine{promise\_create(\mbox{\hyperlink{struct__Eina__Future__Scheduler}{Eina\_Future\_Scheduler}} *scheduler)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Ctx *ctx = malloc(\textcolor{keyword}{sizeof}(Ctx));}
\DoxyCodeLine{   \textcolor{comment}{// A timer is scheduled in order to resolve the promise}}
\DoxyCodeLine{   ctx-\/>timer = \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(122, \_promise\_resolve, ctx);}
\DoxyCodeLine{   \textcolor{comment}{// The \_promise\_cancel() will be used to clean ctx if the promise is canceled.}}
\DoxyCodeLine{   ctx-\/>p = eina\_promise\_new(scheduler, \_promise\_cancel, ctx);}
\DoxyCodeLine{   \textcolor{keywordflow}{return} ctx-\/>p;}
\DoxyCodeLine{\}}
\end{DoxyCode}


If you already have a value and want to create a future that will resolve to it directly use the \mbox{\hyperlink{group__Eina__Future_ga333ff19929c6dfb4c2c115ccf783d3f0}{eina\+\_\+future\+\_\+resolved()}}, it has the same effect as creating a promise and immediately resolving it.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em scheduler} & The scheduler. \\
\hline
\mbox{\texttt{ in}}  & {\em cancel\+\_\+cb} & A callback used to inform that the promise was canceled. Use this callback to {\ttfamily free} {\ttfamily data}. {\ttfamily cancel\+\_\+cb} must not be {\ttfamily N\+U\+LL} ! \\
\hline
\mbox{\texttt{ in}}  & {\em data} & Data to {\ttfamily cancel\+\_\+cb}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A promise or {\ttfamily N\+U\+LL} on error. 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
eina\+\_\+future\+\_\+cancel() 

\mbox{\hyperlink{group__Eina__Future_ga4ae0bbfdefe911b043e0ae5b4d030e7e}{eina\+\_\+future\+\_\+new()}} 

\mbox{\hyperlink{group__Eina__Promise_ga1464d3d3f6a5eaea0b7ba51a78065ee2}{eina\+\_\+promise\+\_\+continue\+\_\+new()}} 

\mbox{\hyperlink{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}{eina\+\_\+promise\+\_\+resolve()}} 

\mbox{\hyperlink{group__Eina__Promise_gac2390dbab710385eac56b38395bc2a7a}{eina\+\_\+promise\+\_\+reject()}} 

\mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}} 

\#\+Eina\+\_\+\+Future\+\_\+\+Scheduler 

\#\+Eina\+\_\+\+Future\+\_\+\+Scheduler\+\_\+\+Entry 

\mbox{\hyperlink{group__Eina__Promise_gac685b488df7948131b6405451d0b4fb5}{Eina\+\_\+\+Future\+\_\+\+Scheduler\+\_\+\+Cb}} 
\end{DoxySeeAlso}


\doxysubsection{Typedef Documentation}
\mbox{\Hypertarget{group__Eina__Promise_gad3a38a209f2112fbe1eb111e0d3ff939}\label{group__Eina__Promise_gad3a38a209f2112fbe1eb111e0d3ff939}} 
\index{Eina\_Promise@{Eina\_Promise}!Eina\_Future\_Cb@{Eina\_Future\_Cb}}
\index{Eina\_Future\_Cb@{Eina\_Future\_Cb}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{Eina\_Future\_Cb}{Eina\_Future\_Cb}}
{\footnotesize\ttfamily Eina\+\_\+\+Future\+\_\+\+Cb Eina\+\_\+\+Future\+\_\+\+Cb}

A callback used to inform that a future was resolved. Usually this callback is called from a clean context, that is, from the main loop or some platform defined safe context. However there are 2 exceptions\+:

\begin{DoxyItemize}
\item eina\+\_\+future\+\_\+cancel() was used, it\textquotesingle{}s called immediately in the context that called cancel using {\ttfamily E\+C\+A\+N\+C\+E\+L\+ED} as error.\end{DoxyItemize}
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__Eina__Future_ga9f4948790f1f84de93ba8195520d4a92}{eina\+\_\+future\+\_\+then()}}, \mbox{\hyperlink{group__Eina__Future_ga20c3b066d8c3418891e71a0d0c5103ea}{eina\+\_\+future\+\_\+then\+\_\+from\+\_\+desc()}}, \mbox{\hyperlink{group__Eina__Future_gaeb721d890aa5eac3103a982edde76e9a}{eina\+\_\+future\+\_\+chain()}}, \mbox{\hyperlink{group__Eina__Future_ga74c9d6017478584a85b8e3914083c728}{eina\+\_\+future\+\_\+chain\+\_\+array()}} or similar failed due to invalid pointer or memory allocation. Then the callback is called from the failed context using {\ttfamily E\+I\+N\+V\+AL} or {\ttfamily E\+N\+O\+M\+EM} as errors and {\ttfamily dead\+\_\+future} will be {\ttfamily N\+U\+LL}.\end{DoxyItemize}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em data} & The data provided by the user\\
\hline
\mbox{\texttt{ in}}  & {\em value} & An Eina\+\_\+\+Value which contains the operation result. Before using the {\ttfamily value}, its type must be checked in order to avoid errors. This is needed because if an operation fails the Eina\+\_\+\+Value type will be E\+I\+N\+A\+\_\+\+V\+A\+L\+U\+E\+\_\+\+T\+Y\+P\+E\+\_\+\+E\+R\+R\+OR which is a different type than the expected operation result.\\
\hline
\mbox{\texttt{ in}}  & {\em dead\+\_\+future} & A pointer to the future that was completed.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An Eina\+\_\+\+Value to pass to the next Eina\+\_\+\+Future in the chain (if any). If there is no need to convert the received value, it\textquotesingle{}s {\bfseries{recommended}} to passthrough {\ttfamily value} argument. If you need to convert to a different type or generate a new value, use {\ttfamily \mbox{\hyperlink{group__Eina__Value__Value__Group_gab5c6558b1b8be2ad597d71a765cbf5f6}{eina\+\_\+value\+\_\+setup()}}} on {\bfseries{another}} Eina\+\_\+\+Value and return it. By returning a promise Eina\+\_\+\+Value (\mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}}) the whole chain will wait until the promise is resolved in order to continue its execution. Note that the value contents must survive this function scope, that is, do {\bfseries{not}} use stack allocated blobs, arrays, structures or types that keep references to memory you give. Values will be automatically cleaned up using {\ttfamily \mbox{\hyperlink{group__Eina__Value__Value__Group_ga940660709a2862bafac92f47bb721a68}{eina\+\_\+value\+\_\+flush()}}} once they are unused (no more future or futures returned a new value).
\end{DoxyReturn}
\begin{DoxyNote}{Note}
The returned value {\bfseries{can}} be an E\+F\+L\+\_\+\+V\+A\+L\+U\+E\+\_\+\+T\+Y\+P\+E\+\_\+\+P\+R\+O\+M\+I\+S\+E! (see \mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}} and \mbox{\hyperlink{group__Eina__Future_gaacfa57469fcd9467f14a529e7b72887b}{eina\+\_\+future\+\_\+as\+\_\+value()}}) In this case the future chain will wait until the promise is resolved.
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
eina\+\_\+future\+\_\+cancel() 

\mbox{\hyperlink{group__Eina__Future_ga9f4948790f1f84de93ba8195520d4a92}{eina\+\_\+future\+\_\+then()}} 

\mbox{\hyperlink{group__Eina__Future_ga20c3b066d8c3418891e71a0d0c5103ea}{eina\+\_\+future\+\_\+then\+\_\+from\+\_\+desc()}} 

\mbox{\hyperlink{group__Eina__Future_ga1125fb075daa2ac3548ee4a55d69190c}{eina\+\_\+future\+\_\+then\+\_\+easy()}} 

\mbox{\hyperlink{group__Eina__Future_gaeb721d890aa5eac3103a982edde76e9a}{eina\+\_\+future\+\_\+chain()}} 

\mbox{\hyperlink{group__Eina__Future_ga74c9d6017478584a85b8e3914083c728}{eina\+\_\+future\+\_\+chain\+\_\+array()}} 

\mbox{\hyperlink{group__Eina__Future_gaacfa57469fcd9467f14a529e7b72887b}{eina\+\_\+future\+\_\+as\+\_\+value()}} 

\mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Promise_gac685b488df7948131b6405451d0b4fb5}\label{group__Eina__Promise_gac685b488df7948131b6405451d0b4fb5}} 
\index{Eina\_Promise@{Eina\_Promise}!Eina\_Future\_Scheduler\_Cb@{Eina\_Future\_Scheduler\_Cb}}
\index{Eina\_Future\_Scheduler\_Cb@{Eina\_Future\_Scheduler\_Cb}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{Eina\_Future\_Scheduler\_Cb}{Eina\_Future\_Scheduler\_Cb}}
{\footnotesize\ttfamily Eina\+\_\+\+Future\+\_\+\+Scheduler\+\_\+\+Cb}

A callback used by the Eina\+\_\+\+Future\+\_\+\+Scheduler to deliver the future operation result.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ out}}  & {\em f} & The delivered future. \\
\hline
\mbox{\texttt{ in}}  & {\em value} & The future result\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
eina\+\_\+promise\+\_\+new()

\#\+Eina\+\_\+\+Future\+\_\+\+Schedule\+\_\+\+Entry 

\#\+Eina\+\_\+\+Future\+\_\+\+Scheduler 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Promise_ga328997a45f6c2645410b9d2201859ed7}\label{group__Eina__Promise_ga328997a45f6c2645410b9d2201859ed7}} 
\index{Eina\_Promise@{Eina\_Promise}!Eina\_Promise\_Cancel\_Cb@{Eina\_Promise\_Cancel\_Cb}}
\index{Eina\_Promise\_Cancel\_Cb@{Eina\_Promise\_Cancel\_Cb}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{Eina\_Promise\_Cancel\_Cb}{Eina\_Promise\_Cancel\_Cb}}
{\footnotesize\ttfamily Eina\+\_\+\+Promise\+\_\+\+Cancel\+\_\+\+Cb Eina\+\_\+\+Promise\+\_\+\+Cancel\+\_\+\+Cb}

A callback used to inform that a promise was canceled.

A promise may be canceled by the user calling {\ttfamily eina\+\_\+future\+\_\+cancel()} on any Eina\+\_\+\+Future that is part of the chain that uses an Eina\+\_\+\+Promise, that will cancel the whole chain and then the promise.

It should stop all asynchronous operations or at least mark them to be discarded instead of resolved. Actually it can\textquotesingle{}t be resolved once canceled since the given pointer {\ttfamily dead\+\_\+promise} is now invalid.

\begin{DoxyNote}{Note}
This callback is {\bfseries{mandatory}} for a reason, do not provide an empty callback as it\textquotesingle{}ll likely result in memory corruption and invalid access. If impossible to cancel an asynchronous task, then create an intermediate memory to hold Eina\+\_\+\+Promise and make it {\ttfamily N\+U\+LL}, in this callback. Then prior to resolution check if the pointer is set.

This callback is {\bfseries{not}} called if \mbox{\hyperlink{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}{eina\+\_\+promise\+\_\+resolve()}} or \mbox{\hyperlink{group__Eina__Promise_gac2390dbab710385eac56b38395bc2a7a}{eina\+\_\+promise\+\_\+reject()}} are used. If any cleanup is needed, then call yourself. It\textquotesingle{}s only meant as cancellation, not a general \char`\"{}free callback\char`\"{}.
\end{DoxyNote}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em data} & The data provided by the user. \\
\hline
\mbox{\texttt{ in}}  & {\em dead\+\_\+promise} & The canceled promise. \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Promise_gac2390dbab710385eac56b38395bc2a7a}{eina\+\_\+promise\+\_\+reject()}} 

\mbox{\hyperlink{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}{eina\+\_\+promise\+\_\+resolve()}} 

eina\+\_\+future\+\_\+cancel() 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Promise_ga93b2841efbc82b31ea37cf0edeb60a9d}\label{group__Eina__Promise_ga93b2841efbc82b31ea37cf0edeb60a9d}} 
\index{Eina\_Promise@{Eina\_Promise}!Eina\_Future\_Success\_Cb@{Eina\_Future\_Success\_Cb}}
\index{Eina\_Future\_Success\_Cb@{Eina\_Future\_Success\_Cb}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{Eina\_Future\_Success\_Cb}{Eina\_Future\_Success\_Cb}}
{\footnotesize\ttfamily Eina\+\_\+\+Future\+\_\+\+Success\+\_\+\+Cb Eina\+\_\+\+Future\+\_\+\+Success\+\_\+\+Cb}

A callback used to inform that the future completed with success.

Unlike \mbox{\hyperlink{group__Eina__Promise_gad3a38a209f2112fbe1eb111e0d3ff939}{Eina\+\_\+\+Future\+\_\+\+Cb}} this callback only called if the future operation was successful, this is, no errors occurred ({\ttfamily value} type differs from E\+I\+N\+A\+\_\+\+V\+A\+L\+U\+E\+\_\+\+T\+Y\+P\+E\+\_\+\+E\+R\+R\+OR) and the {\ttfamily value} matches \mbox{\hyperlink{struct__Eina__Future__Cb__Easy__Desc_a5112a2ccff7f8b1c48c242763a948d05}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Easy\+\_\+\+Desc\+::success\+\_\+type}} (if given). In case \mbox{\hyperlink{struct__Eina__Future__Cb__Easy__Desc_a5112a2ccff7f8b1c48c242763a948d05}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Easy\+\_\+\+Desc\+::success\+\_\+type}} was not supplied (it\textquotesingle{}s {\ttfamily N\+U\+LL}) the {\ttfamily value} type must be checked before using it.

\begin{DoxyNote}{Note}
This function is always called from a safe context (main loop or some platform defined safe context).
\end{DoxyNote}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em data} & The data provided by the user. \\
\hline
\mbox{\texttt{ in}}  & {\em value} & The operation result \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An Eina\+\_\+\+Value to pass to the next Eina\+\_\+\+Future in the chain (if any). If there is no need to convert the received value, it\textquotesingle{}s {\bfseries{recommended}} to passthrough {\ttfamily value} argument. If you need to convert to a different type or generate a new value, use {\ttfamily \mbox{\hyperlink{group__Eina__Value__Value__Group_gab5c6558b1b8be2ad597d71a765cbf5f6}{eina\+\_\+value\+\_\+setup()}}} on {\bfseries{another}} Eina\+\_\+\+Value and return it. By returning a promise Eina\+\_\+\+Value (\mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}}) the whole chain will wait until the promise is resolved in order to continue its execution. Note that the value contents must survive this function scope, that is, do {\bfseries{not}} use stack allocated blobs, arrays, structures or types that keep references to memory you give. Values will be automatically cleaned up using {\ttfamily \mbox{\hyperlink{group__Eina__Value__Value__Group_ga940660709a2862bafac92f47bb721a68}{eina\+\_\+value\+\_\+flush()}}} once they are unused (no more future or futures returned a new value). 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Future_gaad0c23b540f1424301d2609a35ef8eac}{eina\+\_\+future\+\_\+cb\+\_\+easy\+\_\+from\+\_\+desc()}} 

\mbox{\hyperlink{group__Eina__Future_ga57f56d13f3f3bb13651ea3b81b59e8f1}{eina\+\_\+future\+\_\+cb\+\_\+easy()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Promise_gaa851e400869a2ca7b072d348175bd83f}\label{group__Eina__Promise_gaa851e400869a2ca7b072d348175bd83f}} 
\index{Eina\_Promise@{Eina\_Promise}!Eina\_Future\_Error\_Cb@{Eina\_Future\_Error\_Cb}}
\index{Eina\_Future\_Error\_Cb@{Eina\_Future\_Error\_Cb}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{Eina\_Future\_Error\_Cb}{Eina\_Future\_Error\_Cb}}
{\footnotesize\ttfamily Eina\+\_\+\+Future\+\_\+\+Error\+\_\+\+Cb Eina\+\_\+\+Future\+\_\+\+Error\+\_\+\+Cb}

A callback used to inform that the future completed with failure.

Unlike \mbox{\hyperlink{group__Eina__Promise_ga93b2841efbc82b31ea37cf0edeb60a9d}{Eina\+\_\+\+Future\+\_\+\+Success\+\_\+\+Cb}} this function is only called when an error occurs during the future process or when \mbox{\hyperlink{struct__Eina__Future__Cb__Easy__Desc_a5112a2ccff7f8b1c48c242763a948d05}{\+\_\+\+Eina\+\_\+\+Future\+\_\+\+Cb\+\_\+\+Easy\+\_\+\+Desc\+::success\+\_\+type}} differs from the future result. On future creation errors and future cancellation this function will be called from the current context with the following errors respectfully\+: {\ttfamily E\+I\+N\+V\+AL}, {\ttfamily E\+N\+O\+M\+EM} and {\ttfamily E\+C\+A\+N\+C\+E\+L\+ED}. Otherwise this function is called from a safe context.

If it was possible to recover from an error this function should return an empty value {\ttfamily return E\+I\+N\+A\+\_\+\+V\+A\+L\+U\+E\+\_\+\+E\+M\+P\+TY;} or any other Eina\+\_\+\+Value type that differs from E\+I\+N\+A\+\_\+\+V\+A\+L\+U\+E\+\_\+\+T\+Y\+P\+E\+\_\+\+E\+R\+R\+OR. In this case the error will not be reported by the other futures in the chain (if any), otherwise if an Eina\+\_\+\+Value type E\+I\+N\+A\+\_\+\+V\+A\+L\+U\+E\+\_\+\+T\+Y\+P\+E\+\_\+\+E\+R\+R\+OR is returned the error will continue to be reported to the other futures in the chain.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em data} & The data provided by the user. \\
\hline
\mbox{\texttt{ in}}  & {\em error} & The operation error \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An Eina\+\_\+\+Value to pass to the next Eina\+\_\+\+Future in the chain (if any). If you need to convert to a different type or generate a new value, use {\ttfamily \mbox{\hyperlink{group__Eina__Value__Value__Group_gab5c6558b1b8be2ad597d71a765cbf5f6}{eina\+\_\+value\+\_\+setup()}}} on {\bfseries{another}} Eina\+\_\+\+Value and return it. By returning a promise Eina\+\_\+\+Value (\mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}}) the whole chain will wait until the promise is resolved in order to continue its execution. Note that the value contents must survive this function scope, that is, do {\bfseries{not}} use stack allocated blobs, arrays, structures or types that keep references to memory you give. Values will be automatically cleaned up using {\ttfamily \mbox{\hyperlink{group__Eina__Value__Value__Group_ga940660709a2862bafac92f47bb721a68}{eina\+\_\+value\+\_\+flush()}}} once they are unused (no more future or futures returned a new value). 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Future_gaad0c23b540f1424301d2609a35ef8eac}{eina\+\_\+future\+\_\+cb\+\_\+easy\+\_\+from\+\_\+desc()}} 

\mbox{\hyperlink{group__Eina__Future_ga57f56d13f3f3bb13651ea3b81b59e8f1}{eina\+\_\+future\+\_\+cb\+\_\+easy()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__Eina__Promise_ga8d3d898f0c73827404fc2e258767a6c7}\label{group__Eina__Promise_ga8d3d898f0c73827404fc2e258767a6c7}} 
\index{Eina\_Promise@{Eina\_Promise}!Eina\_Future\_Free\_Cb@{Eina\_Future\_Free\_Cb}}
\index{Eina\_Future\_Free\_Cb@{Eina\_Future\_Free\_Cb}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{Eina\_Future\_Free\_Cb}{Eina\_Future\_Free\_Cb}}
{\footnotesize\ttfamily Eina\+\_\+\+Future\+\_\+\+Free\+\_\+\+Cb Eina\+\_\+\+Future\+\_\+\+Free\+\_\+\+Cb}

A callback used to inform that the future was freed and the user should also {\ttfamily free} the {\ttfamily data}. This callback may be called from an unsafe context if the future was canceled or an error occurred.

\begin{DoxyNote}{Note}
This callback is always called, even if \mbox{\hyperlink{group__Eina__Promise_gaa851e400869a2ca7b072d348175bd83f}{Eina\+\_\+\+Future\+\_\+\+Error\+\_\+\+Cb}} and/or \mbox{\hyperlink{group__Eina__Promise_ga93b2841efbc82b31ea37cf0edeb60a9d}{Eina\+\_\+\+Future\+\_\+\+Success\+\_\+\+Cb}} were not provided, which can also be used to monitor when a future ends.
\end{DoxyNote}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em data} & The data provided by the user. \\
\hline
\mbox{\texttt{ in}}  & {\em dead\+\_\+future} & The future that was freed.\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__Eina__Future_gaad0c23b540f1424301d2609a35ef8eac}{eina\+\_\+future\+\_\+cb\+\_\+easy\+\_\+from\+\_\+desc()}} 

\mbox{\hyperlink{group__Eina__Future_ga57f56d13f3f3bb13651ea3b81b59e8f1}{eina\+\_\+future\+\_\+cb\+\_\+easy()}} 
\end{DoxySeeAlso}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__Eina__Promise_ga1464d3d3f6a5eaea0b7ba51a78065ee2}\label{group__Eina__Promise_ga1464d3d3f6a5eaea0b7ba51a78065ee2}} 
\index{Eina\_Promise@{Eina\_Promise}!eina\_promise\_continue\_new@{eina\_promise\_continue\_new}}
\index{eina\_promise\_continue\_new@{eina\_promise\_continue\_new}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{eina\_promise\_continue\_new()}{eina\_promise\_continue\_new()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} Eina\+\_\+\+Promise$\ast$ eina\+\_\+promise\+\_\+continue\+\_\+new (\begin{DoxyParamCaption}\item[{const Eina\+\_\+\+Future $\ast$}]{dead\+\_\+future,  }\item[{\mbox{\hyperlink{group__Eina__Promise_ga328997a45f6c2645410b9d2201859ed7}{Eina\+\_\+\+Promise\+\_\+\+Cancel\+\_\+\+Cb}}}]{cancel\+\_\+cb,  }\item[{const void $\ast$}]{data }\end{DoxyParamCaption})}



Creates a new promise from a dead\+\_\+future. 

This function creates a new promise from a future currently being resolved which can be used to create a \mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}} with \mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}}. Every time a promise is created a \mbox{\hyperlink{group__Eina__Promise_ga328997a45f6c2645410b9d2201859ed7}{Eina\+\_\+\+Promise\+\_\+\+Cancel\+\_\+\+Cb}} must be provided which is used to free resources that were created.

A promise may be canceled directly by calling {\ttfamily eina\+\_\+future\+\_\+cancel}(eina\+\_\+future\+\_\+new(eina\+\_\+promise\+\_\+new(...))) that is, canceling any future that is chained to receive the results.

However promises can be canceled indirectly by other entities. These other entities will call {\ttfamily eina\+\_\+future\+\_\+cancel()} themselves, however you may not be aware of that. Some common sources of indirect cancellations\+:

\begin{DoxyItemize}
\item A subsystem was shutdown, canceling all pending futures (i.\+e.\+: \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\+\_\+shutdown()}})\end{DoxyItemize}
\begin{DoxyItemize}
\item An EO object was linked to the promise or future, then if the object dies (last reference is gone), then the pending promises and futures will be canceled.\end{DoxyItemize}
\begin{DoxyItemize}
\item Some other entity (library provider or library user) chained and canceled his future, which will result in your future being canceled.\end{DoxyItemize}
Since a promise may be canceled indirectly (by code sections that goes beyond your scope) you should always provide a cancel callback, even if you think you\textquotesingle{}ll not need it.

Here\textquotesingle{}s a typical example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}}}
\DoxyCodeLine{\_future\_resolve(\textcolor{keywordtype}{void} *data, \textcolor{keyword}{const} \mbox{\hyperlink{struct__Eina__Value}{Eina\_Value}} v, \textcolor{keyword}{const} Eina\_Future *dead\_future)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   Eina\_Promise *p;}
\DoxyCodeLine{   p = \mbox{\hyperlink{group__Eina__Promise_ga1464d3d3f6a5eaea0b7ba51a78065ee2}{eina\_promise\_continue\_new}}(dead\_future, \_promise\_cancel, NULL);}
\DoxyCodeLine{   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\_promise\_as\_value}}(p);}
\DoxyCodeLine{\}}
\end{DoxyCode}


If you already have a value and want to create a future that will resolve to it directly use the \mbox{\hyperlink{group__Eina__Future_ga333ff19929c6dfb4c2c115ccf783d3f0}{eina\+\_\+future\+\_\+resolved()}}, it has the same effect as creating a promise and immediately resolving it.

\begin{DoxyNote}{Note}
This function is to be used solely inside of a future resolve callback with the Eina\+\_\+\+Value being returned from it.
\end{DoxyNote}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em dead\+\_\+future} & The future being resolved to get a scheduler from. \\
\hline
\mbox{\texttt{ in}}  & {\em cancel\+\_\+cb} & A callback used to inform that the promise was canceled. Use this callback to {\ttfamily free} {\ttfamily data}. {\ttfamily cancel\+\_\+cb} must not be {\ttfamily N\+U\+LL} ! \\
\hline
\mbox{\texttt{ in}}  & {\em data} & Data to {\ttfamily cancel\+\_\+cb}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A promise or {\ttfamily N\+U\+LL} on error. 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
eina\+\_\+future\+\_\+cancel() 

\mbox{\hyperlink{group__Eina__Future_ga4ae0bbfdefe911b043e0ae5b4d030e7e}{eina\+\_\+future\+\_\+new()}} 

eina\+\_\+promise\+\_\+new() 

\mbox{\hyperlink{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}{eina\+\_\+promise\+\_\+resolve()}} 

\mbox{\hyperlink{group__Eina__Promise_gac2390dbab710385eac56b38395bc2a7a}{eina\+\_\+promise\+\_\+reject()}} 

\mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}} 

\#\+Eina\+\_\+\+Future\+\_\+\+Scheduler 

\#\+Eina\+\_\+\+Future\+\_\+\+Scheduler\+\_\+\+Entry 

\mbox{\hyperlink{group__Eina__Promise_gac685b488df7948131b6405451d0b4fb5}{Eina\+\_\+\+Future\+\_\+\+Scheduler\+\_\+\+Cb}} 
\end{DoxySeeAlso}


References D\+BG, eina\+\_\+mempool\+\_\+calloc(), E\+I\+N\+A\+\_\+\+S\+A\+F\+E\+T\+Y\+\_\+\+O\+N\+\_\+\+N\+U\+L\+L\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+AL, and E\+I\+N\+A\+\_\+\+S\+A\+F\+E\+T\+Y\+\_\+\+O\+N\+\_\+\+T\+R\+U\+E\+\_\+\+R\+E\+T\+U\+R\+N\+\_\+\+V\+AL.

\mbox{\Hypertarget{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}\label{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}} 
\index{Eina\_Promise@{Eina\_Promise}!eina\_promise\_resolve@{eina\_promise\_resolve}}
\index{eina\_promise\_resolve@{eina\_promise\_resolve}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{eina\_promise\_resolve()}{eina\_promise\_resolve()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void eina\+\_\+promise\+\_\+resolve (\begin{DoxyParamCaption}\item[{Eina\+\_\+\+Promise $\ast$}]{p,  }\item[{\mbox{\hyperlink{group__Eina__Value__Group_ga7985e8af6e956ae31b381bf829173cc0}{Eina\+\_\+\+Value}}}]{value }\end{DoxyParamCaption})}



Resolves a promise. 

This function schedules a resolve event in a safe context (main loop or some platform defined safe context), whenever possible the future callbacks will be dispatched.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em p} & A promise to resolve. \\
\hline
\mbox{\texttt{ in}}  & {\em value} & The value to be delivered.\\
\hline
\end{DoxyParams}
Note that the {\ttfamily value} contents must survive this function scope, that is, do {\bfseries{not}} use stack allocated blobs, arrays, structures or types that keep references to memory you give. Values will be automatically cleaned up using {\ttfamily \mbox{\hyperlink{group__Eina__Value__Value__Group_ga940660709a2862bafac92f47bb721a68}{eina\+\_\+value\+\_\+flush()}}} once they are unused (no more future or futures returned a new value).

\begin{DoxySeeAlso}{See also}
eina\+\_\+promise\+\_\+new() 

\mbox{\hyperlink{group__Eina__Promise_gac2390dbab710385eac56b38395bc2a7a}{eina\+\_\+promise\+\_\+reject()}} 

\mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}} 
\end{DoxySeeAlso}


References eina\+\_\+value\+\_\+flush().

\mbox{\Hypertarget{group__Eina__Promise_gac2390dbab710385eac56b38395bc2a7a}\label{group__Eina__Promise_gac2390dbab710385eac56b38395bc2a7a}} 
\index{Eina\_Promise@{Eina\_Promise}!eina\_promise\_reject@{eina\_promise\_reject}}
\index{eina\_promise\_reject@{eina\_promise\_reject}!Eina\_Promise@{Eina\_Promise}}
\doxysubsubsection{\texorpdfstring{eina\_promise\_reject()}{eina\_promise\_reject()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__Elua_ga3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+PI}} void eina\+\_\+promise\+\_\+reject (\begin{DoxyParamCaption}\item[{Eina\+\_\+\+Promise $\ast$}]{p,  }\item[{\mbox{\hyperlink{group__Eina__Error__Group_ga95b3cbb33e987e7d92a81ea785001686}{Eina\+\_\+\+Error}}}]{err }\end{DoxyParamCaption})}



Rejects a promise. 

This function schedules a reject event in a safe context (main loop or some platform defined safe context), whenever possible the future callbacks will be dispatched.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em p} & A promise to reject. \\
\hline
\mbox{\texttt{ in}}  & {\em err} & An Eina\+\_\+\+Error value \\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
Internally this function will create an Eina\+\_\+\+Value with type \mbox{\hyperlink{group__Eina__Value__Group_gafb778d4e5353abc9df922a4b309fe35a}{E\+I\+N\+A\+\_\+\+V\+A\+L\+U\+E\+\_\+\+T\+Y\+P\+E\+\_\+\+E\+R\+R\+OR}}.
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
eina\+\_\+promise\+\_\+new() 

\mbox{\hyperlink{group__Eina__Promise_gad325942e86b9ce92c9f9c5aa062f0290}{eina\+\_\+promise\+\_\+resolve()}} 

\mbox{\hyperlink{group__Eina__Future_ga02fdf9a0ba1a47431606ee8c16f1a914}{eina\+\_\+promise\+\_\+as\+\_\+value()}} 
\end{DoxySeeAlso}


References D\+BG, eina\+\_\+error\+\_\+msg\+\_\+get(), E\+I\+N\+A\+\_\+\+S\+A\+F\+E\+T\+Y\+\_\+\+O\+N\+\_\+\+F\+A\+L\+S\+E\+\_\+\+G\+O\+TO, eina\+\_\+value\+\_\+flush(), eina\+\_\+value\+\_\+set(), eina\+\_\+value\+\_\+setup(), and E\+I\+N\+A\+\_\+\+V\+A\+L\+U\+E\+\_\+\+T\+Y\+P\+E\+\_\+\+E\+R\+R\+OR.

