Changeset d5cca04 in mainline
- Timestamp:
- 2019-08-17T13:10:27Z (5 years ago)
- Children:
- ff20afc
- Parents:
- 87a31ef2
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-12-04 13:30:06)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-17 13:10:27)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/sysman/sysman.c
r87a31ef2 rd5cca04 63 63 } observed_object_t; 64 64 65 typedef struct { 66 job_t *job; 67 callback_handler_t callback; 68 void *callback_arg; 69 } job_args_t; 70 65 71 static LIST_INITIALIZE(event_queue); 66 72 static fibril_mutex_t event_queue_mtx; … … 214 220 } 215 221 216 if (callback != NULL) { 217 job_add_ref(job); 218 //TODO sysman_object_observer is not fibril-safe CANNOT BE CALLED HERE! 219 sysman_object_observer(job, callback, callback_arg); 220 } 221 222 /* Pass reference to event */ 223 sysman_raise_event(&sysman_event_job_process, job); 222 job_args_t *job_args = malloc(sizeof(job_args_t)); 223 if (job_args == NULL) { 224 job_del_ref(&job); 225 return ENOMEM; 226 } 227 228 /* Pass reference to job_args */ 229 job_args->job = job; 230 job_args->callback = callback; 231 job_args->callback_arg = callback_arg; 232 233 sysman_raise_event(&sysman_event_job_process, job_args); 224 234 225 235 return EOK; … … 354 364 void sysman_event_job_process(void *data) 355 365 { 356 job_t *job = data; 366 job_args_t *job_args = data; 367 job_t *job = job_args->job; 357 368 dyn_array_t job_closure; 358 369 dyn_array_initialize(&job_closure, job_t *); 370 371 if (job_args->callback != NULL) { 372 job_add_ref(job); 373 sysman_object_observer(job, job_args->callback, job_args->callback_arg); 374 } 375 free(job_args); 359 376 360 377 int rc = job_create_closure(job, &job_closure);
Note:
See TracChangeset
for help on using the changeset viewer.