File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 2828struct Lock {
2929 pthread_spinlock_t lock;
3030 pthread_t owner;
31- int recursion_count;
31+ size_t recursion_count;
3232};
3333
3434// Danger zone: the drjit-core locks are held for an extremely short amount of
@@ -63,7 +63,7 @@ inline void lock_release(Lock &lock) {
6363struct Lock {
6464 os_unfair_lock_s lock;
6565 pthread_t owner;
66- int recursion_count;
66+ size_t recursion_count;
6767};
6868
6969inline void lock_init (Lock &lock) {
@@ -91,26 +91,25 @@ inline void lock_release(Lock &lock) {
9191 }
9292}
9393#else
94+ #include < thread>
9495#if defined(_WIN32)
9596#include < shared_mutex>
96- #include < thread>
9797struct Lock {
9898 std::shared_mutex lock; // Based on the faster Win7 SRWLOCK
9999 std::thread::id owner;
100- int recursion_count;
100+ size_t recursion_count;
101101};
102102#else
103103#include < mutex>
104- #include < thread>
105104struct Lock {
106105 std::mutex lock;
107106 std::thread::id owner;
108- int recursion_count;
107+ size_t recursion_count;
109108};
110109#endif
111110
112111inline void lock_init (Lock &lock) {
113- lock.owner = std::thread::id (- 1 );
112+ lock.owner = std::thread::id ();
114113 lock.recursion_count = 0 ;
115114}
116115
@@ -129,7 +128,7 @@ inline void lock_acquire(Lock &lock) {
129128inline void lock_release (Lock &lock) {
130129 lock.recursion_count --;
131130 if (lock.recursion_count == 0 ) {
132- lock.owner = std::thread::id (- 1 );
131+ lock.owner = std::thread::id ();
133132 lock.lock .unlock ();
134133 }
135134}
You can’t perform that action at this time.
0 commit comments