Files
nuttx/sched/event/event_init.c
wangchengdong de5973268b [!] sched/event: Remove wait object dependency from event implementation
The current event implementation relies on a dedicated wait object,
    which introduces several issues:
        1. Increases memory usage
        2. Complicates the event logic
        3. Makes the API design less clean, as it requires a separate
                nxevent_tickwait_wait() function

    This patch removes the event’s dependency on the wait object
    and eliminates the nxevent_tickwait_wait() API accordingly.

    BREAKING CHANGE: this commit removed the nxevent_tickwait_wait function
    so the related docs should be updated accordingly

Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
2025-10-31 19:56:32 -03:00

54 lines
1.9 KiB
C

/****************************************************************************
* sched/event/event_init.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include "event.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxevent_init
*
* Description:
* This routine initializes an event object, Set of default events to post
* to event.
*
* Input Parameters:
* event - Address of the event object
* events - Set of events to post to event
*
* Returned Value:
* None.
*
****************************************************************************/
void nxevent_init(FAR nxevent_t *event, nxevent_mask_t events)
{
event->events = events;
dq_init(EVENT_WAITLIST(event));
}