Bienvenue sur le site de la LibLapin.
Jetez un coup d'oeil en bas de la page pour choisir votre niveau de documentation en fonction de votre niveau avec la LibLapin.
Pour l'instant, c'est réglé sur 'Manuel complet'. Si c'est votre première fois avec la LibLapin, il vaudrait mieux choisir 'Débutant'.
De même, n'oubliez pas de préciser une version de la bibliothèque.
Threads
The threads module header is lapin/threads.h
The LibLapin currently does not support threading on Window.
Functions still works, but they are single threaded.
I hope to change this on the next version (1.13).
Description
  This structure is an abstract type made to represent created threads.
Attributes
-
const void * const _private:
  Private attribute that must not be modified or a crash may happen.
-
size_t nbr_threads:
  The amount of threads that this threadpool represents.
INDEX
Parameters
-
size_t size:
  The amount of threads you want to create.
Return value
-
On success, the function returns the threadpool.
-
On failure, it returns NULL.
Error values and logs
On error, bunny_errno is set to:
Logs written by this function are tagged with the "thread" label.
INDEX
Description
  Delete the sent threadpool.
INDEX
Description
  Push a single work in the threadpool.
Parameters
-
t_bunny_threadpool *pool:
  The threadpool that will be use.
-
t_bunny_function func:
  The function that will be called by the thread to treat data.
-
void *data:
  The data to be treated by func asynchronously in a different thread.
-
void *add_ptr:
  A data that will be sent as second parameter of func.
Return value
-
On success, the function returns true.
-
On failure, it returns false.
Error values and logs
On error, bunny_errno is set to:
Logs written by this function are tagged with the "thread" label.
INDEX
Parameters
-
t_bunny_threadpool *pool:
  The threadpool that will be use.
-
t_bunny_function func:
  The function that will be called for each element of the sent
array. Parameters will be an element from the array and the add_ptr.
-
void **data:
  An array of pointers of data_array_len. Elements from
this array will be sent to the function given in func, one
after the other, following the pace of threads.
-
size_t data_array_len:
  The size of data.
-
void *add_ptr:
  A data that will be sent as second parameter of func.
Return value
-
On success, the function returns true.
-
On failure, it returns false.
Error values and logs
On error, bunny_errno is set to:
Logs written by this function are tagged with the "thread" label.
INDEX
Description
  Wait until all works are complete and there is no more awaiting work
in the threadpool queue.
INDEX
Description
  Create a threadpool integrated to the bunny loop with the sent amount of
thread.
Parameters
-
size_t nbr_thread:
  The amount of threads inside the bunny loop thread pool. You can send
0 to delete the threadpool.
If a threadpool was already present, it may be freed before a new one
is created if it contains a different amount of threads.
Return value
-
On success, the function returns true.
-
On failure, it returns false.
INDEX
Description
  This function push a computation request inside the bunny loop thread pool.
Parameters
-
t_bunny_function func:
  The function to compute with the second parameter as first parameter,
and the loop data as second parameter.
-
void *dt:
  The data to compute.
Return value
-
On success, the function returns true.
-
On failure, it returns false.
INDEX
Description
  This function push several computation request inside the bunny loop
thread pool. As many as len.
Parameters
-
t_bunny_function func:
  The function to compute with an element from the second parameter
as first parameter, and the loop data as second parameter.
-
void **dt:
  An array containing all datas to compute.
-
size_t len:
  The length of dt.
Return value
-
On success, the function returns true.
-
On failure, it returns false.
INDEX