aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/devdraw/cocoa-thread.h
blob: d5793f0a70a3e9cefd6c220217aaf53792945130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * 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

#ifdef TRY_LIBTHREAD
	#include <thread.h>
#else
	#define QLock DQLock
	#define qlock dqlock
	#define qunlock dqunlock
	#define threadexitsall exits
	#define threadmain main

	typedef struct QLock QLock;

	struct QLock
	{
		int init;
		pthread_mutex_t m;
	};

	void	qlock(QLock*);
	void	qunlock(QLock*);
	int threadid(void);
#endif