3 * @author Dario Faggioli <faggioli@gandalf.sssup.it>
5 * @brief FRSH core thread related functions not implamented in managers..
9 #include <fres_contract.h>
10 #include <fres_contract_idl.h>
11 #include <frsh_core.h>
12 #include <frsh_error.h>
13 #include <fres_blocks.h>
16 #include "frsh_forb.h"
17 #include <fra_generic.h>
19 int frsh_thread_create_in_background
20 (frsh_thread_code_t thread_code,
21 const void *thread_arg,
22 const frsh_contract_label_t contract_label,
23 frsh_thread_attr_t *attr,
24 frsh_thread_id_t *thread,
25 frsh_vres_id_t *vres_id)
27 frsh_contract_t contract;
28 fosa_rel_time_t zero_msec = fosa_msec_to_rel_time(0);
31 /* Background contract creation and negotiation */
32 frsh_contract_init(&contract);
33 frsh_contract_set_resource_and_label(&contract,
37 frsh_contract_set_basic_params(&contract,
40 FRSH_WT_INDETERMINATE,
43 /* It will be accepted: we are asking for 0 budget over 0 period */
44 rv = frsh_contract_negotiate(&contract, vres_id);
45 if (rv !=0) goto error;
47 rv = fosa_thread_create(thread, attr, thread_code, (void*) thread_arg);
48 if (rv != 0) goto error;
55 int frsh_thread_get_vres_id
56 (const frsh_thread_id_t thread,
57 frsh_vres_id_t *vres_id)
60 return FRSH_ERR_BAD_ARGUMENT;
62 *vres_id = fra_get_vres_thread_vres(&thread);
64 return vres_id ? 0 : EINVAL;
67 int frsh_service_thread_set_data
68 (const struct timespec *budget,
69 const struct timespec *period,
72 return FRSH_ERR_NOT_IMPLEMENTED;
75 int frsh_service_thread_get_data
76 (frsh_rel_time_t *budget,
77 frsh_rel_time_t *period)
79 return FRSH_ERR_NOT_IMPLEMENTED;