aboutsummaryrefslogtreecommitdiffstats
path: root/src/jobs.h
AgeCommit message (Collapse)AuthorFilesLines
2019-08-19jobs: Add starting mode for jobsJose Bollo1-0/+12
Also improve naming of variables. Bug-AGL: SPEC-2720 Change-Id: I8efa74e27256425df18f57b3de257c234ff60e69 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-04-02jobs: Refactor exiting jobsJosé Bollo1-2/+1
The new termination function can allow the restart because it doesn't abort the waiting jobs. So after calling 'jobs_exit', all threads stop. The function 'job_start' returns. The threads that are in blocking state, i.e. in a call to 'jobs_enter' or 'jobs_call' are stopped. An error status -1 with errno=EINTR is returned in that case. But before returning, that function calls the exit handler if any. Change-Id: I85a4b1976b09b18804eb681af940531ae5ace6c3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27system & jobs: Reverse link and acquiring eventsJosé Bollo1-2/+2
- The new version of 'systemd_get_event_loop' dont depends anymore on jobs but returns a unique systemd event loop for any threads. - The event loop of jobs now use system.h function instead of the opposite. - The function 'jobs_get_sd_event' is removed - The function 'jobs_acquire_event_manager' is introduced. It is designed to that the current thread can manipulate the single event manager Change-Id: I31fe48dfe0f2cfa4d468e49338d36fea6e7e8081 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-06Update copyright datehalibut_7.90.0halibut/7.90.07.90.0José Bollo1-1/+1
Change-Id: I3aaa92b2bfb01699ee8ae609272e93032b6f1a9d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Remove conditionnal REMOVE_SYSTEMD_EVENTJose Bollo1-5/+0
The removal of the systemd event loop will be made in later changes. Change-Id: Ia6c52feb4969f360c31cbfc50ae991f1767f007d Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-07-25Tune dependency to fdev-epollJose Bollo1-5/+7
The dependency to fdev-epoll is not real at the moment because afb-daemon still uses systemd event loop mechanisms. At the end use of it will depend on the conditional compilation flag as REMOVE_SYSTEMD_EVENT here. Change-Id: I46e65cddafef05a9418cd4cf4d5cbf596ebeda49 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2018-06-13jobs: Switch to fdev_epoll instead of sd_eventJosé Bollo1-0/+2
Use by default an epoll of jobs for handling HTTP and websockets. The sd_event loop remains available (to be checked). Change-Id: Iaaad005c9880ba1818936a93c8626490666c9eec Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-27Update date of copyright noticesJosé Bollo1-1/+1
Change-Id: If9d7e7728df086fbb7214f1de5cbec35cd2f1d9b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-02-06jobs: Add argument to startJosé Bollo1-1/+6
Change-Id: I89a75a036c60097fb898ab8723007ca6ebfc7f39 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-10-09jobs: add const qualifier for groupsJosé Bollo1-3/+3
Change-Id: I34faa8e5da4321da53beb323559399d1460562c1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-06-02Fix error on initialisationJosé Bollo1-1/+1
Change-Id: If6a988359b4d2747cefdd683b6328f5b36e37548 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-13Simplification and optimisation of jobsJosé Bollo1-20/+0
It comes from the use of this module that it can be simplified to only get 1 argument. It reduces either the complexity of the code and the time spent in job management. It optimise how normal jobs are called (not intermediate function). Also factorisation and simplification of synchronous enter/call. Change-Id: Id60dd2363fee2b007b4557430659faf733d2179d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-06Add an easy function for synchronous callsJosé Bollo1-0/+6
The added function, 'jobs_call', allows to call a job with 'group' sequencing and 'timeout' handling synchronously. The difference with 'jobs_enter' is that the function 'jobs_call' assert that the job is terminated when 'callback' returns. Change-Id: I8c01d1cd017787ca0448b03a899305a9069ebb6c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-04-03Rework the jobsJosé Bollo1-22/+7
Enforce starting jobs with acquiring the calling thread. Removes invoke methods in favour of enter/leave synchronisation. Change-Id: I7086f7f53b919b43ddafd2355316abc0d3516f49 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-30Overall integration of job initialisationJosé Bollo1-0/+1
Move the job initialisation from main to jobs. Change-Id: I8f5b54adb62e60592884ff1e3fad9811b5934d47 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-30Fix concurrency issues on event managerJosé Bollo1-2/+3
Having only one event manager is not possible in multithreading due to the way that systemd has to manage timer events. We observed that timers were not armed when set in a thread because event was polling in an other thread. This patch provides more than one event manager and at most as many as the number of threads avalaible to start. Change-Id: Iaeab353b7bc79ce61361ab73c7b197a9e69a6109 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-29Add commentsJosé Bollo1-1/+2
Improves the comments of the module jobs Change-Id: Id99e9c6d6c9572d68ae9cca0f13e2498348de91d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-28Refactor job to allow synchronous callsJosé Bollo1-1/+28
The family of methods "jobs_invoke" make synchronous job activation. It waits for the completion of the job while still dispatching it internally and providing the calling thread for processing any job queued. Change-Id: Id36a30789cc51245a7bbfca42f0122cf4ea623b2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-28Fix bug in recycling jobsJosé Bollo1-1/+1
The bug was creating an infinite loop starving the system (or other possible horrific stuff). Also updated the test. Change-Id: Id71dd112d2ed4651ac8aa56d2c57b088d69b8655 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-27Make main thread used for common jobsJosé Bollo1-0/+3
This commit make the main thread behaving like any other threads. The main loop is shared across threads, the first one without job taking it. The main event loop now have the lowest priority. It is activated only when no job is queued. This has the good effect to not try to overfill the queue of jobs. Change-Id: I07cecc9d94a02134c63bc2a814db56e171ab719e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2017-03-22Refactor of threading and signal monitorJosé Bollo1-0/+44
The goal is to allow use of this facilities for things that are not 'afb_req'. Change-Id: I0d99c227934ed45136477bf6235bd1541d5f05cf Signed-off-by: José Bollo <jose.bollo@iot.bzh>