diff options
| author | ruki <[email protected]> | 2025-08-28 22:42:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-08-28 11:35:54 +0800 |
| commit | a3ff692d028873e06cc9827e1ff72dc9ec8b54d4 (patch) | |
| tree | 75815a4402733834ebbd728cb05c7f134d2da51b /core/src/xmake/thread/event_post.c | |
| parent | 09854e59988b3c1269c97dc95ed4f6132bb851f8 (diff) | |
add thread event
Diffstat (limited to 'core/src/xmake/thread/event_post.c')
| -rw-r--r-- | core/src/xmake/thread/event_post.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/core/src/xmake/thread/event_post.c b/core/src/xmake/thread/event_post.c new file mode 100644 index 000000000..0b8e5dabd --- /dev/null +++ b/core/src/xmake/thread/event_post.c @@ -0,0 +1,46 @@ +/*!A cross-platform build utility based on Lua + * + * Licensed 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. + * + * Copyright (C) 2015-present, Xmake Open Source Community. + * + * @author ruki + * @file thread_event_lock.c + * + */ + +/* ////////////////////////////////////////////////////////////////////////////////////// + * trace + */ +#define TB_TRACE_MODULE_NAME "thread_event" +#define TB_TRACE_MODULE_DEBUG (0) + +/* ////////////////////////////////////////////////////////////////////////////////////// + * includes + */ +#include "prefix.h" + +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ +tb_int_t xm_thread_event_post(lua_State* lua) +{ + tb_assert_and_check_return_val(lua, 0); + + xm_thread_event_t* thread_event = xm_thread_event_get(lua, 1); + tb_assert_and_check_return_val(thread_event && thread_event->handle, 0); + + lua_pushboolean(lua, tb_event_post(thread_event->handle)); + return 1; +} + |
