summaryrefslogtreecommitdiff
path: root/src/global.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-08-18 22:11:49 +0200
committerCarlos Martín Nieto <cmn@elego.de>2012-08-20 12:02:52 +0200
commit8cef828d8d115c1f98678c13721fee59ca4540b7 (patch)
tree811ff0ad2b4b324cf4b11fd0f2b0ede1fdc04071 /src/global.h
parent1a10fded40875f986164b80c6efd414cd1507cb8 (diff)
downloadlibgit2-8cef828d8d115c1f98678c13721fee59ca4540b7.tar.gz
Make the memory-window conrol structures global
Up to now, the idea was that the user would do all the operations for one repository in the same thread. Thus we could have the memory-mapped window information thread-local and avoid any locking. This is not practical in a few environments, such as Apple's GCD which allocates threads arbitrarily or the .NET CLR, where the OS-level thread can change at any moment. Make the control structure global and protect it with a mutex so we don't depend on the thread currently executing the code.
Diffstat (limited to 'src/global.h')
-rw-r--r--src/global.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/global.h b/src/global.h
index 6e7373fa3..0ad41ee63 100644
--- a/src/global.h
+++ b/src/global.h
@@ -12,12 +12,12 @@
typedef struct {
git_error *last_error;
git_error error_t;
-
- git_mwindow_ctl mem_ctl;
} git_global_st;
git_global_st *git__global_state(void);
+extern git_mutex git__mwindow_mutex;
+
#define GIT_GLOBAL (git__global_state())
#endif