Tizen Native API
Ecore Pipe Wrapper

This group discusses the functions that wrap the write / read functions of the pipe to easily integrate its use into ecore's main loop.

Remarks:
The ecore_pipe_add() function creates file descriptors (sockets on Windows) and attaches a handle to the ecore main loop. That handle is called when data is read in the pipe. To write data in the pipe, just call ecore_pipe_write(). When you are done, just call ecore_pipe_del().

Functions

Ecore_Pipeecore_pipe_add (Ecore_Pipe_Cb handler, const void *data)
 Create two file descriptors (sockets on Windows).
void * ecore_pipe_del (Ecore_Pipe *p)
 Free an Ecore_Pipe object created with ecore_pipe_add().
Eina_Bool ecore_pipe_write (Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
 Write on the file descriptor the data passed as parameter.
void ecore_pipe_write_close (Ecore_Pipe *p)
 Close the write end of an Ecore_Pipe object created with ecore_pipe_add().
void ecore_pipe_read_close (Ecore_Pipe *p)
 Close the read end of an Ecore_Pipe object created with ecore_pipe_add().
void ecore_pipe_thaw (Ecore_Pipe *p)
 Start monitoring again the pipe for reading. See ecore_pipe_freeze() for stopping the monitoring activity. This will not work if ecore_pipe_read_close() was previously called on the same pipe.
void ecore_pipe_freeze (Ecore_Pipe *p)
 Stop monitoring if necessary the pipe for reading.
int ecore_pipe_wait (Ecore_Pipe *p, int message_count, double wait)
 Wait from another thread on the read side of a pipe.

Typedefs

typedef struct _Ecore_Pipe Ecore_Pipe
 A handle for pipes.
typedef void(* Ecore_Pipe_Cb )(void *data, void *buffer, unsigned int nbyte)
 Called to send data written to the pipe.

Function Documentation

Ecore_Pipe* ecore_pipe_add ( Ecore_Pipe_Cb  handler,
const void *  data 
)

Create two file descriptors (sockets on Windows).

Add a callback that will be called when the file descriptor that is listened receives data. An event is also put in the event queue when data is received.

Since :
2.3.1
Parameters:
[in]handlerThe handler called when data is received.
[in]dataData to pass to handler when it is called.
Returns:
A newly created Ecore_Pipe object if successful. NULL otherwise.
void* ecore_pipe_del ( Ecore_Pipe p)

Free an Ecore_Pipe object created with ecore_pipe_add().

Since :
2.3.1
Parameters:
[in]pThe Ecore_Pipe object to be freed.
Returns:
The pointer to the private data

Stop monitoring if necessary the pipe for reading.

Since (EFL) :
1.1
Since :
2.3.1
Parameters:
[in]pThe Ecore_Pipe object.
See also:
ecore_pipe_thaw() for monitoring it again.

Close the read end of an Ecore_Pipe object created with ecore_pipe_add().

Since :
2.3.1
Parameters:
[in]pThe Ecore_Pipe object.
void ecore_pipe_thaw ( Ecore_Pipe p)

Start monitoring again the pipe for reading. See ecore_pipe_freeze() for stopping the monitoring activity. This will not work if ecore_pipe_read_close() was previously called on the same pipe.

Since (EFL) :
1.1
Since :
2.3.1
Parameters:
[in]pThe Ecore_Pipe object.
int ecore_pipe_wait ( Ecore_Pipe p,
int  message_count,
double  wait 
)

Wait from another thread on the read side of a pipe.

Since (EFL) :
1.1
Since :
2.3.1
Remarks:
Negative value for wait means infite wait.
Parameters:
[in]pThe pipe to watch on.
[in]message_countThe minimal number of message to wait before exiting.
[in]waitThe amount of time in second to wait before exiting.
Returns:
the number of message catched during that wait call.
Eina_Bool ecore_pipe_write ( Ecore_Pipe p,
const void *  buffer,
unsigned int  nbytes 
)

Write on the file descriptor the data passed as parameter.

Since :
2.3.1
Parameters:
[in]pThe Ecore_Pipe object.
[in]bufferThe data to write into the pipe.
[in]nbytesThe size of the buffer in bytes
Returns:
EINA_TRUE on a successful write, EINA_FALSE on error.

Close the write end of an Ecore_Pipe object created with ecore_pipe_add().

Since :
2.3.1
Parameters:
[in]pThe Ecore_Pipe object.