mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
byuu says: Basically just a project rename, with s/bsnes/higan and the new icon from lowkee added in. It won't compile on Windows because I forgot to update the resource.rc file, and a path transform command isn't working on Windows. It was really just meant as a starting point, so that v091 WIPs can flow starting from .00 with the new name (it overshadows bsnes v091, so publicly speaking this "shouldn't exist" and will probably be deleted from Google Code when v092 is ready.)
51 lines
940 B
C
Executable file
51 lines
940 B
C
Executable file
/*
|
|
libco.win (2008-01-28)
|
|
authors: Nach, byuu
|
|
license: public domain
|
|
*/
|
|
|
|
#define LIBCO_C
|
|
#include "libco.h"
|
|
#define WINVER 0x0400
|
|
#define _WIN32_WINNT 0x0400
|
|
#define WIN32_LEAN_AND_MEAN
|
|
#include <windows.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
static thread_local cothread_t co_active_ = 0;
|
|
|
|
static void __stdcall co_thunk(void *coentry) {
|
|
((void (*)(void))coentry)();
|
|
}
|
|
|
|
cothread_t co_active() {
|
|
if(!co_active_) {
|
|
ConvertThreadToFiber(0);
|
|
co_active_ = GetCurrentFiber();
|
|
}
|
|
return co_active_;
|
|
}
|
|
|
|
cothread_t co_create(unsigned int heapsize, void (*coentry)(void)) {
|
|
if(!co_active_) {
|
|
ConvertThreadToFiber(0);
|
|
co_active_ = GetCurrentFiber();
|
|
}
|
|
return (cothread_t)CreateFiber(heapsize, co_thunk, (void*)coentry);
|
|
}
|
|
|
|
void co_delete(cothread_t cothread) {
|
|
DeleteFiber(cothread);
|
|
}
|
|
|
|
void co_switch(cothread_t cothread) {
|
|
co_active_ = cothread;
|
|
SwitchToFiber(cothread);
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|