diff options
| author | Russ Cox <rsc@swtch.com> | 2011-10-12 13:40:35 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@swtch.com> | 2011-10-12 13:40:35 -0400 |
| commit | d0a596c5c8669950a2499d3012c340cfbf0eeed5 (patch) | |
| tree | e2bbf3125aa9f667487589175301029486d5adb9 /src/cmd/devdraw/cocoa-thread.h | |
| parent | 210d461c87a6c5f598ef958b303a7f24d4e4a93b (diff) | |
| download | plan9port-d0a596c5c8669950a2499d3012c340cfbf0eeed5.tar.gz plan9port-d0a596c5c8669950a2499d3012c340cfbf0eeed5.zip | |
devdraw: more fixes (thanks David Jeannot)
Diffstat (limited to 'src/cmd/devdraw/cocoa-thread.h')
| -rw-r--r-- | src/cmd/devdraw/cocoa-thread.h | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/cmd/devdraw/cocoa-thread.h b/src/cmd/devdraw/cocoa-thread.h index 925c4e0e..c2f3e982 100644 --- a/src/cmd/devdraw/cocoa-thread.h +++ b/src/cmd/devdraw/cocoa-thread.h @@ -1,14 +1,33 @@ -#define QLock DQLock -#define qlock dqlock -#define qunlock dqunlock +/* + * I am too ignorant to know if Cocoa and Libthread + * can coexist: if I try to include thread.h, now + * that Devdraw uses Cocoa's threads (and timers), it + * crashes immediately; when Devdraw was using + * proccreate(), it could run a little while before to + * crash; the origin of those crashes is hard to + * ascertain, because other programs using Libthread + * (such as 9term, Acme, Plumber, and Sam) currently + * don't run when compiled with Xcode 4.1. + */ +//#define TRY_LIBTHREAD -typedef struct QLock QLock; +#ifdef TRY_LIBTHREAD + #include <thread.h> +#else + #define QLock DQLock + #define qlock dqlock + #define qunlock dqunlock + #define threadexitsall exits + #define threadmain main -struct QLock -{ - pthread_mutex_t m; - int init; -}; + typedef struct QLock QLock; -void qlock(QLock*); -void qunlock(QLock*); + struct QLock + { + int init; + pthread_mutex_t m; + }; + + void qlock(QLock*); + void qunlock(QLock*); +#endif |
