mirror of https://github.com/flysand7/ciabatta.git
				
				
				
			Make _Thread_local work on windows haven't tested tho
This commit is contained in:
		
							parent
							
								
									7cb9dc133f
								
							
						
					
					
						commit
						5cf93a6532
					
				| 
						 | 
					@ -5,5 +5,4 @@
 | 
				
			||||||
#define EILSEQ 2
 | 
					#define EILSEQ 2
 | 
				
			||||||
#define ERANGE 3
 | 
					#define ERANGE 3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO: make it thread-local
 | 
					extern _Thread_local int errno;
 | 
				
			||||||
extern int errno;
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int errno;
 | 
					_Thread_local int errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,8 @@
 | 
				
			||||||
#include <win.h>
 | 
					#include <win.h>
 | 
				
			||||||
#include <threads.h>
 | 
					#include <threads.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DWORD _tls_index = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void mtx_destroy(mtx_t *mtx) {
 | 
					void mtx_destroy(mtx_t *mtx) {
 | 
				
			||||||
    CloseHandle(mtx->semaphore);
 | 
					    CloseHandle(mtx->semaphore);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
#include <stddef.h>
 | 
					#include <stddef.h>
 | 
				
			||||||
 | 
					#include <errno.h>
 | 
				
			||||||
void do_more_stuff(char *ptr) {
 | 
					void do_more_stuff(char *ptr) {
 | 
				
			||||||
    assert(ptr != NULL);
 | 
					    assert(ptr != NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@ void do_stuff() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main() {
 | 
					int main() {
 | 
				
			||||||
 | 
					    errno = 0;
 | 
				
			||||||
    assert(2+2 == 4);
 | 
					    assert(2+2 == 4);
 | 
				
			||||||
    do_stuff();
 | 
					    do_stuff();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue