Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1984f1e

Browse files
committed
* Makefile adapted to changes below.
* split pythonmain.c in two: most stuff goes to pythonrun.c, in the library. * new optional built-in threadmodule.c, build upon Sjoerd's thread.{c,h}. * new module from Sjoerd: mmmodule.c (dynamically loaded). * new module from Sjoerd: sv (svgen.py, svmodule.c.proto). * new files thread.{c,h} (from Sjoerd). * new xxmodule.c (example only). * myselect.h: bzero -> memset * select.c: bzero -> memset; removed global variable
1 parent 4fbf798 commit 1984f1e

11 files changed

Lines changed: 1249 additions & 393 deletions

File tree

Include/pythread.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef _THREAD_H_included
2+
#define _THREAD_H_included
3+
4+
#ifdef __STDC__
5+
#define _P(args) args
6+
#else
7+
#define _P(args) ()
8+
#endif
9+
10+
void init_thread _P((void));
11+
int start_new_thread _P((void (*)(void *), void *));
12+
void exit_thread _P((void));
13+
14+
typedef void *type_lock;
15+
16+
type_lock allocate_lock _P((void));
17+
void free_lock _P((type_lock));
18+
int acquire_lock _P((type_lock, int));
19+
#define WAIT_LOCK 1
20+
#define NOWAIT_LOCK 0
21+
void release_lock _P((type_lock));
22+
23+
void exit_prog _P((int));
24+
25+
#undef _P
26+
27+
#endif

Include/thread.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef _THREAD_H_included
2+
#define _THREAD_H_included
3+
4+
#ifdef __STDC__
5+
#define _P(args) args
6+
#else
7+
#define _P(args) ()
8+
#endif
9+
10+
void init_thread _P((void));
11+
int start_new_thread _P((void (*)(void *), void *));
12+
void exit_thread _P((void));
13+
14+
typedef void *type_lock;
15+
16+
type_lock allocate_lock _P((void));
17+
void free_lock _P((type_lock));
18+
int acquire_lock _P((type_lock, int));
19+
#define WAIT_LOCK 1
20+
#define NOWAIT_LOCK 0
21+
void release_lock _P((type_lock));
22+
23+
void exit_prog _P((int));
24+
25+
#undef _P
26+
27+
#endif

Modules/config.c.in

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ extern void initpwd();
123123
extern void initgrp();
124124
extern void initmarshal();
125125
extern void initselect();
126+
extern void initsocket();
126127

127128
#ifdef USE_AUDIO
128129
extern void initaudio();
@@ -148,15 +149,15 @@ extern void initpanel();
148149
#ifdef USE_STDWIN
149150
extern void initstdwin();
150151
#endif
151-
#ifdef USE_SOCKET
152-
extern void initsocket();
153-
#endif
154152
#ifdef USE_JPEG
155153
extern void initjpeg();
156154
#endif
157155
#ifdef USE_CD
158156
extern void initcd();
159157
#endif
158+
#ifdef USE_THREAD
159+
extern void initthread();
160+
#endif
160161

161162
struct {
162163
char *name;
@@ -173,6 +174,7 @@ struct {
173174
{"grp", initgrp},
174175
{"marshal", initmarshal},
175176
{"select", initselect},
177+
{"socket", initsocket},
176178

177179

178180
/* Optional modules */
@@ -206,10 +208,6 @@ struct {
206208
{"stdwin", initstdwin},
207209
#endif
208210

209-
#ifdef USE_SOCKET
210-
{"socket", initsocket},
211-
#endif
212-
213211
#ifdef USE_JPEG
214212
{"jpeg", initjpeg},
215213
#endif
@@ -218,5 +216,9 @@ struct {
218216
{"cd", initcd},
219217
#endif
220218

219+
#ifdef USE_THREAD
220+
{"thread", initthread},
221+
#endif
222+
221223
{0, 0} /* Sentinel */
222224
};

0 commit comments

Comments
 (0)