mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-30 23:23:07 +00:00 
			
		
		
		
	Fix #892 - Remove racy ref counts for channels
Rather than manual reference counting for suspended fibers, we automate the process by incrementing "extra_listeners" every time we suspend a fiber in the event loop, and decrement when that fiber is resumed. In this manner, we keep track of the number of suspending fibers in a simpler, more correct way.
This commit is contained in:
		| @@ -48,7 +48,6 @@ | ||||
|  | ||||
| #define JANET_FIBER_STATUS_MASK 0x3F0000 | ||||
| #define JANET_FIBER_RESUME_SIGNAL 0x400000 | ||||
| #define JANET_FIBER_FLAG_CANCELED 0x400000 | ||||
| #define JANET_FIBER_STATUS_OFFSET 16 | ||||
|  | ||||
| #define JANET_FIBER_BREAKPOINT       0x1000000 | ||||
| @@ -57,6 +56,9 @@ | ||||
| #define JANET_FIBER_DID_LONGJUMP     0x8000000 | ||||
| #define JANET_FIBER_FLAG_MASK        0xF000000 | ||||
|  | ||||
| #define JANET_FIBER_EV_FLAG_CANCELED 0x10000 | ||||
| #define JANET_FIBER_EV_FLAG_SUSPENDED 0x20000 | ||||
|  | ||||
| #define janet_fiber_set_status(f, s) do {\ | ||||
|     (f)->flags &= ~JANET_FIBER_STATUS_MASK;\ | ||||
|     (f)->flags |= (s) << JANET_FIBER_STATUS_OFFSET;\ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose