imshow() hangs in beaglebone black.

Why imshow hangs my Beaglebone Black .I am using opencv-2.4 with my webcam Logitech C170.It is working fine in my laptop with ubuntu1410.i am using ubuntu1404 in my Beaglebone black.Here is my code:

`

#include<opencv2/opencv.hpp>
#include<iostream>
#include<string>
#include<fstream>
#include<gtkmm.h>
using namespace cv;
int main()
{
    VideoCapture webcam;
    webcam.open(0);
    Mat frame;
    char key;
   string datetime;
   time_t rawtime;
   struct tm* timeinfo;
   char buffer[80];

    while(true)
    {
        webcam >> frame;
        imshow("MetroCam",frame);
        key = waitKey(10);
        if(key=='s')
    {   
        time(&rawtime);
        timeinfo=localtime(&rawtime);
        strftime(buffer,80,"/home/hib/opencv/MetroImg-%c.jpg",timeinfo);
        datetime=buffer;    
        imwrite(datetime, frame);
    }
    if(key=='q'){
        webcam.release();               
          break;
    }

    }

//    imwrite(datetime, frame);

    return 0;
}

`

Please help.