|
-
Jan 30th, 2003, 12:09 AM
#1
Thread Starter
Hyperactive Member
MultiFibering?
Hi,
Does anyone know what these "FIBER" things are? They come with newer windows.
Code:
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
HANDLE hSemaphore;
void ThreadProc(){
for(int i = 0; i < 10; i++)
cout << "Fiber : " << i << endl;
}
void main(){
::ConvertThreadToFiber(NULL);
LPVOID fi = CreateFiber(0, (LPFIBER_START_ROUTINE)ThreadProc, NULL);
::SwitchToFiber(fi);
::DeleteFiber(fi);
for(int i = 0; i < 10; i++)
cout << "Main : " << i << endl;
}
The "main" is not even executed onse SwitchToFiber call.
-
Jan 30th, 2003, 12:16 AM
#2
Thread Starter
Hyperactive Member
OK... got something more:
Code:
#include <windows.h>
#include <iostream>
using namespace std;
HANDLE hSemaphore;
void ThreadProc(LPVOID* lp){
for(int i = 0; i < 10; i++)
cout << "Fiber : " << i << endl;
SwitchToFiber(GetFiberData());
}
void main(){
::ConvertThreadToFiber(NULL);
LPVOID fi = CreateFiber(0, (LPFIBER_START_ROUTINE)ThreadProc, GetCurrentFiber());
::SwitchToFiber(fi);
::DeleteFiber(fi);
for(int i = 0; i < 10; i++)
cout << "Main : " << i << endl;
}
What are these for?
-
Jan 30th, 2003, 12:20 AM
#3
Frenzied Member
They are similar to threads, however, the application controls when and if the Fibers switch between each other, instead of Windows.
Z.
-
Jan 30th, 2003, 12:39 AM
#4
Thread Starter
Hyperactive Member
Thanks.
This is exactly what I need for my server app. Except, do they run on 9x systems?
-
Jan 30th, 2003, 12:40 AM
#5
Frenzied Member
Not to answer the question but when people enter code. why not turn off smilies, The DISABLE Smilies
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Jan 30th, 2003, 12:46 AM
#6
Thread Starter
Hyperactive Member
Allright. But it is fairly simple to decode with smiles.
-
Jan 30th, 2003, 12:47 AM
#7
Frenzied Member
lol i kinda like the smilies though, it seems to live-en up the code lol
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/
-
Jan 30th, 2003, 12:02 PM
#8
Frenzied Member
From MSDN, CreateFiber():
Windows NT: Requires version 3.51 SP3 or later.
Windows: Requires Windows 98 or later.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Z.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|