Skip to content

Commit e082909

Browse files
committed
implement reload on next call.
1 parent 66d390a commit e082909

7 files changed

+13
-1
lines changed

README

-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ credits
3333
todo
3434
- add stop timer flag to stop the timer thread
3535
- wclose should signal instead of just setting the variable
36-
- implement lneedsreload in lib.c

bin/.game_server.dll

0 Bytes
Binary file not shown.

bin/game_server.dll

0 Bytes
Binary file not shown.

bin/game_server.exe

0 Bytes
Binary file not shown.

bin/login_server.exe

0 Bytes
Binary file not shown.

lib.c

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ enum lstatus lload(struct lib *lib)
2323
return luptodate;
2424

2525
if (lib->handle) {
26+
if (!lib->reload_on_next_call) {
27+
lib->reload_on_next_call = 1;
28+
return lneedsreload;
29+
}
30+
2631
result = lreloaded;
2732
FreeLibrary(lib->handle);
2833
lib->handle = 0;
@@ -42,6 +47,7 @@ enum lstatus lload(struct lib *lib)
4247
return lfailed;
4348

4449
lib->loaded_time = fattr.ftLastWriteTime;
50+
lib->reload_on_next_call = 0;
4551

4652
return result;
4753
#endif
@@ -57,6 +63,11 @@ enum lstatus lload(struct lib *lib)
5763
return luptodate;
5864

5965
if (lib->handle) {
66+
if (!lib->reload_on_next_call) {
67+
lib->reload_on_next_call = 1;
68+
return lneedsreload;
69+
}
70+
6071
result = lreloaded;
6172
dlclose(lib->handle);
6273
lib->handle = 0;
@@ -67,6 +78,7 @@ enum lstatus lload(struct lib *lib)
6778
return lfailed;
6879

6980
lib->loaded_time = fattr.st_mtime;
81+
lib->reload_on_next_call = 0;
7082

7183
return result;
7284
#endif

lib.h

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
struct lib {
1010
void *handle;
1111
const char *path;
12+
int reload_on_next_call;
1213

1314
#ifdef _WIN32
1415
char copy_path[256];

0 commit comments

Comments
 (0)