File tree Expand file tree Collapse file tree 13 files changed +79
-15
lines changed
port/linux/package/pikascript/pikascript-lib/pika_lvgl Expand file tree Collapse file tree 13 files changed +79
-15
lines changed Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
@@ -1490,7 +1490,6 @@ int pika_lvgl_keyboard_get_selected_btn(PikaObj* self) {
1490
1490
return lv_keyboard_get_selected_btn (lv_obj );
1491
1491
}
1492
1492
1493
-
1494
1493
/*
1495
1494
class ime_pinyin(lv_obj):
1496
1495
def __init__(self, parent: lv_obj): ...
@@ -1534,5 +1533,4 @@ PikaObj* pika_lvgl_ime_pinyin_get_cand_panel(PikaObj* self) {
1534
1533
return new_obj ;
1535
1534
}
1536
1535
1537
-
1538
1536
#endif
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
Original file line number Diff line number Diff line change 1
- #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
1
+ #if defined(LV_LVGL_H_INCLUDE_SIMPLE )
2
2
#include "lvgl.h"
3
3
#else
4
4
#include "../../lvgl.h"
@@ -1490,7 +1490,6 @@ int pika_lvgl_keyboard_get_selected_btn(PikaObj* self) {
1490
1490
return lv_keyboard_get_selected_btn (lv_obj );
1491
1491
}
1492
1492
1493
-
1494
1493
/*
1495
1494
class ime_pinyin(lv_obj):
1496
1495
def __init__(self, parent: lv_obj): ...
@@ -1534,5 +1533,4 @@ PikaObj* pika_lvgl_ime_pinyin_get_cand_panel(PikaObj* self) {
1534
1533
return new_obj ;
1535
1534
}
1536
1535
1537
-
1538
1536
#endif
Original file line number Diff line number Diff line change @@ -805,6 +805,62 @@ PIKA_WEAK int pika_platform_thread_mutex_destroy(
805
805
#endif
806
806
}
807
807
808
+ int pika_thread_recursive_mutex_init (pika_thread_recursive_mutex_t * m ) {
809
+ int ret = pika_platform_thread_mutex_init (& m -> mutex );
810
+ if (ret != 0 ) {
811
+ return ret ;
812
+ }
813
+ m -> owner = 0 ;
814
+ m -> lock_times = 0 ;
815
+ return 0 ;
816
+ }
817
+
818
+ int pika_thread_recursive_mutex_lock (pika_thread_recursive_mutex_t * m ) {
819
+ uint64_t self = pika_platform_thread_self ();
820
+ if (m -> owner == self ) {
821
+ m -> lock_times ++ ;
822
+ return 0 ;
823
+ }
824
+ int ret = pika_platform_thread_mutex_lock (& m -> mutex );
825
+ if (ret != 0 ) {
826
+ return ret ;
827
+ }
828
+ m -> owner = self ;
829
+ m -> lock_times = 1 ;
830
+ return 0 ;
831
+ }
832
+
833
+ int pika_thread_recursive_mutex_trylock (pika_thread_recursive_mutex_t * m ) {
834
+ uint64_t self = pika_platform_thread_self ();
835
+ if (m -> owner == self ) {
836
+ m -> lock_times ++ ;
837
+ return 0 ;
838
+ }
839
+ int ret = pika_platform_thread_mutex_trylock (& m -> mutex );
840
+ if (ret != 0 ) {
841
+ return ret ;
842
+ }
843
+ m -> owner = self ;
844
+ m -> lock_times = 1 ;
845
+ return 0 ;
846
+ }
847
+
848
+ int pika_thread_recursive_mutex_unlock (pika_thread_recursive_mutex_t * m ) {
849
+ if (m -> owner != pika_platform_thread_self ()) {
850
+ return -1 ;
851
+ }
852
+ m -> lock_times -- ;
853
+ if (m -> lock_times == 0 ) {
854
+ m -> owner = 0 ;
855
+ return pika_platform_thread_mutex_unlock (& m -> mutex );
856
+ }
857
+ return 0 ;
858
+ }
859
+
860
+ int pika_thread_recursive_mutex_destroy (pika_thread_recursive_mutex_t * m ) {
861
+ return pika_platform_thread_mutex_destroy (& m -> mutex );
862
+ }
863
+
808
864
PIKA_WEAK void pika_platform_thread_timer_init (pika_platform_timer_t * timer ) {
809
865
#ifdef __linux
810
866
timer -> time = (struct timeval ){0 , 0 };
Original file line number Diff line number Diff line change @@ -318,6 +318,18 @@ int pika_platform_thread_mutex_trylock(pika_platform_thread_mutex_t* m);
318
318
int pika_platform_thread_mutex_unlock (pika_platform_thread_mutex_t * m );
319
319
int pika_platform_thread_mutex_destroy (pika_platform_thread_mutex_t * m );
320
320
321
+ typedef struct pika_thread_recursive_mutex {
322
+ pika_platform_thread_mutex_t mutex ;
323
+ uint64_t owner ;
324
+ volatile int lock_times ;
325
+ } pika_thread_recursive_mutex_t ;
326
+
327
+ int pika_thread_recursive_mutex_init (pika_thread_recursive_mutex_t * m );
328
+ int pika_thread_recursive_mutex_lock (pika_thread_recursive_mutex_t * m );
329
+ int pika_thread_recursive_mutex_trylock (pika_thread_recursive_mutex_t * m );
330
+ int pika_thread_recursive_mutex_unlock (pika_thread_recursive_mutex_t * m );
331
+ int pika_thread_recursive_mutex_destroy (pika_thread_recursive_mutex_t * m );
332
+
321
333
#ifdef __linux
322
334
#include <sys/time.h>
323
335
typedef struct pika_platform_timer {
Original file line number Diff line number Diff line change 2
2
#define PIKA_VERSION_MINOR 13
3
3
#define PIKA_VERSION_MICRO 2
4
4
5
- #define PIKA_EDIT_TIME "2024/02/18 20:58:13 "
5
+ #define PIKA_EDIT_TIME "2024/02/19 22:35:07 "
You can’t perform that action at this time.
0 commit comments