|
| 1 | +/* |
| 2 | + * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package libuv |
| 18 | + |
| 19 | +import ( |
| 20 | + _ "unsafe" |
| 21 | + |
| 22 | + "github.com/goplus/llgo/c" |
| 23 | +) |
| 24 | + |
| 25 | +// struct uv_async_t |
| 26 | +type Async struct { |
| 27 | + Handle |
| 28 | + // On macOS arm64, sizeof uv_async_t is 128 bytes. |
| 29 | + // Handle is 92 bytes, so we need 36 bytes to fill the gap. |
| 30 | + // Maybe reserve more for future use. |
| 31 | + Unused [36]byte |
| 32 | +} |
| 33 | + |
| 34 | +// typedef void (*uv_async_cb)(uv_async_t* handle); |
| 35 | +// llgo:type C |
| 36 | +type AsyncCb func(*Async) |
| 37 | + |
| 38 | +// int uv_async_init(uv_loop_t*, uv_async_t* async, uv_async_cb async_cb); |
| 39 | +// |
| 40 | +// llgo:link (*Loop).Async C.uv_async_init |
| 41 | +func (loop *Loop) Async(a *Async, cb AsyncCb) c.Int { |
| 42 | + return 0 |
| 43 | +} |
| 44 | + |
| 45 | +// int uv_async_send(uv_async_t* async); |
| 46 | +// |
| 47 | +// llgo:link (*Async).Send C.uv_async_send |
| 48 | +func (a *Async) Send() c.Int { |
| 49 | + return 0 |
| 50 | +} |
0 commit comments