215 }
216 }
217
218 /* NOTREACHED */
219 }
220
221 static struct slm_mod_ops sysevent_reg_mod_ops = {
222 SE_MAJOR_VERSION, SE_MINOR_VERSION, SE_MAX_RETRY_LIMIT, deliver_event};
223
224 struct slm_mod_ops *
225 slm_init()
226 {
227 cleanup = 0;
228 sysevent_hp = NULL;
229
230 (void) init_channel();
231
232 (void) mutex_init(&evq_lock, USYNC_THREAD, NULL);
233 (void) cond_init(&evq_cv, USYNC_THREAD, NULL);
234
235 if (thr_create(NULL, NULL, (void *(*)(void *))subscriber_deliver_thr,
236 NULL, 0, &deliver_thr_id) != 0) {
237 syseventd_err_print(INIT_SUB_THR_CREATE_ERR, strerror(errno));
238 return (NULL);
239 }
240
241 return (&sysevent_reg_mod_ops);
242 }
243
244 void
245 slm_fini()
246 {
247 (void) mutex_lock(&evq_lock);
248 cleanup = 1;
249 (void) cond_signal(&evq_cv);
250 (void) mutex_unlock(&evq_lock);
251
252 /* Wait for delivery threads to exit */
253 (void) thr_join(deliver_thr_id, NULL, NULL);
254
255 (void) mutex_destroy(&evq_lock);
|
215 }
216 }
217
218 /* NOTREACHED */
219 }
220
221 static struct slm_mod_ops sysevent_reg_mod_ops = {
222 SE_MAJOR_VERSION, SE_MINOR_VERSION, SE_MAX_RETRY_LIMIT, deliver_event};
223
224 struct slm_mod_ops *
225 slm_init()
226 {
227 cleanup = 0;
228 sysevent_hp = NULL;
229
230 (void) init_channel();
231
232 (void) mutex_init(&evq_lock, USYNC_THREAD, NULL);
233 (void) cond_init(&evq_cv, USYNC_THREAD, NULL);
234
235 if (thr_create(NULL, 0, (void *(*)(void *))subscriber_deliver_thr,
236 NULL, 0, &deliver_thr_id) != 0) {
237 syseventd_err_print(INIT_SUB_THR_CREATE_ERR, strerror(errno));
238 return (NULL);
239 }
240
241 return (&sysevent_reg_mod_ops);
242 }
243
244 void
245 slm_fini()
246 {
247 (void) mutex_lock(&evq_lock);
248 cleanup = 1;
249 (void) cond_signal(&evq_cv);
250 (void) mutex_unlock(&evq_lock);
251
252 /* Wait for delivery threads to exit */
253 (void) thr_join(deliver_thr_id, NULL, NULL);
254
255 (void) mutex_destroy(&evq_lock);
|