Results 1 to 8 of 8

Thread: MultiFibering?

  1. #1

    Thread Starter
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394

    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.
    VS.NET 2003

    Need to email me?

  2. #2

    Thread Starter
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    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?
    VS.NET 2003

    Need to email me?

  3. #3
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    They are similar to threads, however, the application controls when and if the Fibers switch between each other, instead of Windows.

    Z.

  4. #4

    Thread Starter
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    Thanks.

    This is exactly what I need for my server app. Except, do they run on 9x systems?
    VS.NET 2003

    Need to email me?

  5. #5
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    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/

  6. #6

    Thread Starter
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    Allright. But it is fairly simple to decode with smiles.
    VS.NET 2003

    Need to email me?

  7. #7
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    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/

  8. #8
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    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
  •  



Click Here to Expand Forum to Full Width