source: mainline/uspace/srv/sysman/job.h@ 59ba708

Last change on this file since 59ba708 was 6efec7e3, checked in by Matthieu Riolo <matthieu.riolo@…>, 6 years ago

Unit polymorphism (simple mount), debug logging

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#ifndef SYSMAN_JOB_H
2#define SYSMAN_JOB_H
3
4#include <adt/list.h>
5#include <atomic.h>
6
7#include "unit.h"
8
9struct job;
10typedef struct job job_t;
11
12typedef enum {
13 JOB_START
14} job_type_t;
15
16typedef enum {
17 JOB_WAITING,
18 JOB_RUNNING,
19 JOB_FINISHED
20} job_state_t;
21
22typedef struct {
23 link_t link;
24 job_t *job;
25} job_link_t;
26
27/** Job represents pending or running operation on unit */
28struct job {
29 /** Link to queue job is in */
30 link_t link;
31
32 /** List of jobs (job_link_t ) that are blocking the job. */
33 list_t blocking_jobs;
34
35 /** Reference counter for the job structure. */
36 atomic_t refcnt;
37
38 job_type_t type;
39 unit_t *unit;
40
41 job_state_t state;
42 fibril_mutex_t state_mtx;
43 fibril_condvar_t state_cv;
44
45 /** Return value of the job, defined only when state == JOB_FINISHED */
46 int retval;
47};
48
49extern void job_queue_init(void);
50extern int job_queue_jobs(list_t *);
51
52extern int job_wait(job_t *);
53
54extern void job_add_ref(job_t *);
55extern void job_del_ref(job_t **);
56
57extern job_t *job_create(job_type_t type);
58extern int job_add_blocking_job(job_t *, job_t *);
59
60#endif
Note: See TracBrowser for help on using the repository browser.