mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
parent
5c716afb39
commit
6ec931c781
@ -30,6 +30,18 @@ fn C.pthread_cond_wait(voidptr, voidptr) int
|
||||
fn C.pthread_cond_timedwait(voidptr, voidptr, voidptr) int
|
||||
fn C.pthread_cond_destroy(voidptr) int
|
||||
|
||||
[typedef]
|
||||
struct C.pthread_mutex_t {}
|
||||
|
||||
[typedef]
|
||||
struct C.pthread_rwlock_t {}
|
||||
|
||||
[typedef]
|
||||
struct C.pthread_rwlockattr_t {}
|
||||
|
||||
[typedef]
|
||||
struct C.sem_t {}
|
||||
|
||||
// [init_with=new_mutex] // TODO: implement support for this struct attribute, and disallow Mutex{} from outside the sync.new_mutex() function.
|
||||
[heap]
|
||||
pub struct Mutex {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import sync
|
||||
|
||||
fn test_array_of_floats() {
|
||||
// f64 array
|
||||
aa := [1.2, 3.4, 5.67]
|
||||
@ -444,3 +446,20 @@ fn test_fixed_array_of_function() {
|
||||
println(a)
|
||||
assert '$a' == '[fn (string), fn (string)]'
|
||||
}
|
||||
|
||||
struct CTypeDefStruct {
|
||||
mutex &sync.Mutex
|
||||
}
|
||||
|
||||
fn test_c_struct_typedef() {
|
||||
$if macos || linux {
|
||||
c := CTypeDefStruct{
|
||||
mutex: sync.new_mutex()
|
||||
}
|
||||
assert c.str() == r'CTypeDefStruct{
|
||||
mutex: &sync.Mutex{
|
||||
mutex: pthread_mutex_t{}
|
||||
}
|
||||
}'
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user